Excel to Word

jognat

New Member
Joined
Aug 24, 2012
Messages
3
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:

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.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,215,256
Messages
6,123,906
Members
449,132
Latest member
Rosie14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top