Hello,
I have been lurking and trying to piece together a solution, but due to my inexperience I have failed.
My intentions are as follows:
I would like create a macro which will enable me to extract specific fields from a row of data to populate a table in Word. But, I would also like this to be repeatable. Example: if I have 10 rows of data, I would like it to extract the same data from each row to populate a separate Word document.
Is this possible? Suggested method?
I have tried bookmarking things in Word, however I was never able to have it identify the bookmark in Excel. Sample of the code I used:
Thanks.
I have been lurking and trying to piece together a solution, but due to my inexperience I have failed.
My intentions are as follows:
I would like create a macro which will enable me to extract specific fields from a row of data to populate a table in Word. But, I would also like this to be repeatable. Example: if I have 10 rows of data, I would like it to extract the same data from each row to populate a separate Word document.
Is this possible? Suggested method?
I have tried bookmarking things in Word, however I was never able to have it identify the bookmark in Excel. Sample of the code I used:
Code:
Sub Testing12()
Dim wdApp As Object, wd As Object, ac As Long, ws As Worksheet
Set ws = Worksheets("Data")
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wd = wdApp.Documents.Open("C:\test_doc.docx")
wdApp.Visible = True
With wd
.FormFields("EventName").Result = ws.Range("A2").Value
End With
Set wd = Nothing
Set wdApp = Nothing
End Sub
Thanks.