Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MS Word application find and replace
#9
Hi Gintaras,
I found out that in Macro 2354, it did run the macro1 on the specified file but it open the doc file in a new document and not in the current doc file. So you end up having 2 separated files. I tweak it a litte bit to have it open the specified document only therefore the macro1 will be applied to the right document.
Macro Macro2354
Code:
Copy      Help
;run Word and open file
typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application app._create
app.Visible = TRUE
Word.Documents docs=app.Documents
VARIANT d=_s.expandpath("$documents$\My Best Story.docx")
;Word.Document doc=docs.Add(d)
Word.Document doc=docs.Open(d)
;run a Word macro
app.Run("Macro1")

On the same token in Macro 2351, it did apply the macro1 on the new document but not on the current document.
so I ended up by just calling like its original version
Macro Macro2351
Code:
Copy      Help
;/exe 1
;Use /exe 1 to run the macro in separate process, as User.
;This macro may not work without it.

typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application app._getactive
;Word.Documents docs=app.Documents
;VARIANT d=_s.expandpath("$documents$\My Best Story.docx")
;Word.Document doc=docs.Add(d)
;act "Word"
;doc.Activate
;run a Word macro
app.Run("Macro1")

Thanks a lot for your quick responses.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)