G
gazza67
Hi,
I am using Word 2000 and Excel 2000. I want to run a script in an
excel document that will open a word document, go to a bookmark within
the document and then copy and paste some info from the word document
into the excel document (ie populate the worksheet from a word
document).
I have added a microsoft word reference to my excel script and the
script successfully opens the word document in question. However when
I get to the "Selection.GoTo What:=wdGoToBookmark" statement I get the
error Object doesn't support this property or method (Error 438).
Is anybody able to help me with this problem.
I will include the script code;
Sub CreateNewWordDoc()
' to test this code, paste it into an Excel module
' add a reference to the Word-library
' create a new folder named C:\Foldername or edit the filnames in the
code
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
' Set wrdDoc = wrdApp.Documents.Add ' create a new document
' or
Set wrdDoc = wrdApp.Documents.Open("G:\Gary\testing\handovertest
\Handovers\Aug\010807.doc")
' open an existing document
' example word operations
With wrdDoc
Selection.GoTo What:=wdGoToBookmark, Name:="aa"
End With
End Sub
Regards,
Gary
I am using Word 2000 and Excel 2000. I want to run a script in an
excel document that will open a word document, go to a bookmark within
the document and then copy and paste some info from the word document
into the excel document (ie populate the worksheet from a word
document).
I have added a microsoft word reference to my excel script and the
script successfully opens the word document in question. However when
I get to the "Selection.GoTo What:=wdGoToBookmark" statement I get the
error Object doesn't support this property or method (Error 438).
Is anybody able to help me with this problem.
I will include the script code;
Sub CreateNewWordDoc()
' to test this code, paste it into an Excel module
' add a reference to the Word-library
' create a new folder named C:\Foldername or edit the filnames in the
code
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
' Set wrdDoc = wrdApp.Documents.Add ' create a new document
' or
Set wrdDoc = wrdApp.Documents.Open("G:\Gary\testing\handovertest
\Handovers\Aug\010807.doc")
' open an existing document
' example word operations
With wrdDoc
Selection.GoTo What:=wdGoToBookmark, Name:="aa"
End With
End Sub
Regards,
Gary