Good day,
When I run the following code..
Public Function Update_Word()
Dim WordDoc As Object
Dim ActiveDocument As Object
Dim sDocName As String
Set WordDoc = CreateObject("Word.Application"
sDocName = "C:\Temp\mydoc.doc"
Set ActiveDocument = GetObject(sDocName)
ActiveDocument.SaveAs "C:\Temp\mydoc1.doc"
dDate = Me![txtDate]
dtime = Me![txtTime]
ActiveDocument.Bookmarks.Item("Date_Time"
.Range.Text = "ONE"
ActiveDocument.Save
ActiveDocument.Application.Quit
Set WordDoc = Nothing
End Function
I get a Run-time error '-2147417851 (80010105): Method 'Text' of object 'Range' failed
When I choose debug it drops me to the Bookmark section of code. If I comment that out and let it move on and then go open the new document, the bookmark has the text "ONE" inserted.
What is causing this error? How can I make it go away?
Thanks,
Shane
When I run the following code..
Public Function Update_Word()
Dim WordDoc As Object
Dim ActiveDocument As Object
Dim sDocName As String
Set WordDoc = CreateObject("Word.Application"
sDocName = "C:\Temp\mydoc.doc"
Set ActiveDocument = GetObject(sDocName)
ActiveDocument.SaveAs "C:\Temp\mydoc1.doc"
dDate = Me![txtDate]
dtime = Me![txtTime]
ActiveDocument.Bookmarks.Item("Date_Time"
ActiveDocument.Save
ActiveDocument.Application.Quit
Set WordDoc = Nothing
End Function
I get a Run-time error '-2147417851 (80010105): Method 'Text' of object 'Range' failed
When I choose debug it drops me to the Bookmark section of code. If I comment that out and let it move on and then go open the new document, the bookmark has the text "ONE" inserted.
What is causing this error? How can I make it go away?
Thanks,
Shane