ak_254
03-15-2018, 12:44 PM
Hi all,
I currently have a Word Document with multiple Bookmarks in place that I use to push data from an Excel Cell range to fill in via VBA Macro.
Since the data in the Excel Cell range is dynamic and consistantly changing I will need to be able to update the text in these Bookmarks on a continous basis.
I am currently able to push data out from a Cell in Excel to a Bookmark in Word but need a way to clear/replace the text in the Bookmarks from a previous update.
Any help or point in the right direction would be greatly appreciated!
The VBA code I am currently running in Excel:
Sub Update_Catalog_Data()
' Update Accessory Stock Status in Catalog
Dim objWord As Object
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Accessory List")
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open "C:\Desktop\Accessory Catalog.docx"
With objWord.ActiveDocument
.Bookmarks("Store1").Range.Text = ws.Range("A10").Value
.Bookmarks("Store2").Range.Text = ws.Range("B10").Value
End With
Set objWord = Nothing
End Sub
I currently have a Word Document with multiple Bookmarks in place that I use to push data from an Excel Cell range to fill in via VBA Macro.
Since the data in the Excel Cell range is dynamic and consistantly changing I will need to be able to update the text in these Bookmarks on a continous basis.
I am currently able to push data out from a Cell in Excel to a Bookmark in Word but need a way to clear/replace the text in the Bookmarks from a previous update.
Any help or point in the right direction would be greatly appreciated!
The VBA code I am currently running in Excel:
Sub Update_Catalog_Data()
' Update Accessory Stock Status in Catalog
Dim objWord As Object
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Accessory List")
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open "C:\Desktop\Accessory Catalog.docx"
With objWord.ActiveDocument
.Bookmarks("Store1").Range.Text = ws.Range("A10").Value
.Bookmarks("Store2").Range.Text = ws.Range("B10").Value
End With
Set objWord = Nothing
End Sub