I am trying to open a word document from excel, find a bookmark within the document and type something there. Sounsd simple? Well, I can't get it to work. Maybe one of you can. Before I trash this stupid computer and get a pencil and a piece of paper instead.
Here is what I have got so far:
Set myWord = CreateObject("Word.Application")
myWord.Visible = True
myWord.documents.Open FileName:="C:MyDocumentsTestingmyFile.doc", ReadOnly:=True
With myWord
.Selection.GoTo What:=wdGoToBookmark, Name:="bkmTitle"
.Selection.typetext Text:=myCourse
End With
The document will open, but it says the bookmark does not exist. If I stop the macro, and go into the word document, the bookmark is definately there, and if I record a macro to go to it in word, it looks just like the line here, all I have added is a dot at the start because it's within a "With" routine.
Any help on why it's not working appreciated, but to win tonights star prize, you have to fix it.
Thanks dudes,
Phil.
ps. I am using office 97
Here is what I have got so far:
Set myWord = CreateObject("Word.Application")
myWord.Visible = True
myWord.documents.Open FileName:="C:MyDocumentsTestingmyFile.doc", ReadOnly:=True
With myWord
.Selection.GoTo What:=wdGoToBookmark, Name:="bkmTitle"
.Selection.typetext Text:=myCourse
End With
The document will open, but it says the bookmark does not exist. If I stop the macro, and go into the word document, the bookmark is definately there, and if I record a macro to go to it in word, it looks just like the line here, all I have added is a dot at the start because it's within a "With" routine.
Any help on why it's not working appreciated, but to win tonights star prize, you have to fix it.
Thanks dudes,
Phil.
ps. I am using office 97