Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Trying to capture a Word event with VBScript

12 views
Skip to first unread message

Perrico

unread,
Nov 29, 2006, 8:19:41 AM11/29/06
to
Hi to everybody,

First of all i apologize for my poor english and VBScript level.

I've been trying to capture the MS Word's Save command from a .vbs.
I´m using a .vbs file for opening a word file and, once opened, i'd
wish to intercept the Save command as an event, in order to do some
things before saving. I've been 3 days searching info and trying
differents things with no results :p In fact, i don't know yet if is
possible to do this in VBScript.

Code:

Dim guord, documento,doc,oShell,alive
on error Resume Next

Set guord=CreateObject("Word.Application")
Set oShell= CreateObject("WSCript.shell")
alive=1
doc=AbrirWord.getDoc() 'doc=path to the .doc file

if doc <>"" then
if not isNull(doc) then
Set documento = guord.Documents.Open(doc)

guord.Visible = true
documento.Windows(1).Visible = true

oShell.AppActivate(guord)
oShell.AppActivate(documento)

' now i have the .doc opened and this is when the save event would
happen


Thanks in Advance!

0 new messages