J
JDupont
I am trying to update the text in a word document that has a bookmark called
Text2.
Then save the document as a new doc.
This is my code:
Dim wordApp As New Microsoft.Office.Interop.Word.Application
Dim newDoc As New Word.Document
newDoc = wordApp.Documents.Open("C:\mydoc")
'This is where my error occurs!
newDoc.Bookmarks.Item("Text2").Range.Text = "New Text"
'The error message is "Range can not be deleted!"
newDoc.SaveAs("c:\NewDoc")
Can you please help?
Thanks!
Text2.
Then save the document as a new doc.
This is my code:
Dim wordApp As New Microsoft.Office.Interop.Word.Application
Dim newDoc As New Word.Document
newDoc = wordApp.Documents.Open("C:\mydoc")
'This is where my error occurs!
newDoc.Bookmarks.Item("Text2").Range.Text = "New Text"
'The error message is "Range can not be deleted!"
newDoc.SaveAs("c:\NewDoc")
Can you please help?
Thanks!