T
tomek milewski
Hello,
I'm trying to open and mainipulate word document from excel macro.
I've written smthg like this, and it doesn't work in excel :
Sub example()
Dim WordObj As Object
Dim doc As Object
Set WordObj = CreateObject("Word.Application")
Set doc = WordObj.Documents.Open("c:\example.doc")
WordObj.Visible = True
WordObj.Selection.HomeKey Unit:=wdStory 'this line doesnt work
doc.Saved = True
WordObj.Quit
End Sub
HomeKey, MoveRight etc. doesn't work. They work only with no arguments.
Please, tell me why it fails and, what is more important, how to fix
it.
I'm using office 2000
I'm trying to open and mainipulate word document from excel macro.
I've written smthg like this, and it doesn't work in excel :
Sub example()
Dim WordObj As Object
Dim doc As Object
Set WordObj = CreateObject("Word.Application")
Set doc = WordObj.Documents.Open("c:\example.doc")
WordObj.Visible = True
WordObj.Selection.HomeKey Unit:=wdStory 'this line doesnt work
doc.Saved = True
WordObj.Quit
End Sub
HomeKey, MoveRight etc. doesn't work. They work only with no arguments.
Please, tell me why it fails and, what is more important, how to fix
it.
I'm using office 2000