Reputation: 53
I am a newbie to Excel VBA. I need to accomplish an important automation task using Excel VBA. It requires pulling specific data/text from Word file to Excel sheet. Please see attached sample files.
The highlighted date and each date under it in Word file needs to be extracted and put into the 'PO issue date' column in Excel first sheet. Similarly, each part number (highlighted) in word file needs to be put it into the 'Funai Part No' column.
Similarly, the quantity in word file under 'TOTAL' needs to be put into the 'Required Qty' column and PO number in word file (Lastrow end value - 70525003) needs to be put into the 'PO Number' column. This PO number will be similar for all other dates as well entered in Excel.
Upvotes: 0
Views: 488
Reputation: 20342
Can you add Bookmarks to Word, and run the script below?
Sub PushToWord()
Dim objWord As New Word.Application
Dim doc As Word.Document
Dim bkmk As Word.Bookmark
sWdFileName = Application.GetOpenFilename(, , , , False)
Set doc = objWord.Documents.Open(sWdFileName)
On Error Resume Next
Range("B1").Value = ActiveDocument.Variables("BrokerFirstName").Value
Range("B2").Value = ActiveDocument.Variables("BrokerLastName").Value
ActiveDocument.Fields.Update
On Error Resume Next
objWord.Visible = True
End Sub
That should give you what you want.
Upvotes: 0