A
anadem
There's sure to be a better way, but is it possible to close Word from
a macro? (Not close the doc, but quit Word itself)
I need to run a (recorded+edited) macro to adjust a number of docs
which are generated by Robohelp. My naive plan is to run Word
repeatedly for each .doc from a .BAT script, thus:
DOMAC.BAT
<path>\Winword.exe /mdostuff mytext.doc
where the dostuff macro is something like:
Sub dostuff()
' stuff
ActiveDocument.Save
ActiveDocument.Close
' plus something here to shut Word down
End Sub
Alternatively, if VBS automation would make it easier to do, please
tell me how to run a macro from VBS. I found these starting & ending
vbscript fragments, which work, but don't know where to go for more ...
strDoc = "mytext.doc"
Set WordApp = CreateObject("Word.Application")
WordApp.Documents.Open strDoc, false,,false
< need to run the macro here >
WordApp.ActiveDocument.Close
WordApp.Quit
Set WordApp = Nothing
apologies if this is too raw to be bearable -- I'm trying to solve a
problem asap and don't have time to do better. (I tried to get the
macro code to run in VBS but it's taking too long.)
many thanks for any advice
a macro? (Not close the doc, but quit Word itself)
I need to run a (recorded+edited) macro to adjust a number of docs
which are generated by Robohelp. My naive plan is to run Word
repeatedly for each .doc from a .BAT script, thus:
DOMAC.BAT
<path>\Winword.exe /mdostuff mytext.doc
where the dostuff macro is something like:
Sub dostuff()
' stuff
ActiveDocument.Save
ActiveDocument.Close
' plus something here to shut Word down
End Sub
Alternatively, if VBS automation would make it easier to do, please
tell me how to run a macro from VBS. I found these starting & ending
vbscript fragments, which work, but don't know where to go for more ...
strDoc = "mytext.doc"
Set WordApp = CreateObject("Word.Application")
WordApp.Documents.Open strDoc, false,,false
< need to run the macro here >
WordApp.ActiveDocument.Close
WordApp.Quit
Set WordApp = Nothing
apologies if this is too raw to be bearable -- I'm trying to solve a
problem asap and don't have time to do better. (I tried to get the
macro code to run in VBS but it's taking too long.)
many thanks for any advice