Hi all,
I have a macro for Excel that I use to get customer information into a separate workbook.
This is it:
My question is I would like to be able to modify this code to work in Word to send the same data to the same place. The thing that seems to make it tricky is that the data is in an Excel table inside the Word document. Can this be done & if yes......how?
I have a macro for Excel that I use to get customer information into a separate workbook.
This is it:
Code:
Sub SendData()
Dim wb1 As Workbook, wb2 As Workbook, ws1 As Worksheet, ws2 As Worksheet
Set wb1 = Workbooks("Final Bill11")
Set wb2 = Workbooks("Customer Details.xls")
Set ws1 = wb1.Worksheets("Sheet1")
Set ws2 = wb2.Worksheets("Sheet1")
ws2.Range("A65536").End(xlUp).Offset(1, 0) = ws1.Range("Name")
ws2.Range("A65536").End(xlUp).Offset(0, 1) = ws1.Range("Phone")
ws2.Range("A65536").End(xlUp).Offset(0, 2) = ws1.Range("Address")
ws2.Range("A65536").End(xlUp).Offset(0, 3) = ws1.Range("City")
ws2.Range("A65536").End(xlUp).Offset(0, 4) = ws1.Range("Date")
End Sub
My question is I would like to be able to modify this code to work in Word to send the same data to the same place. The thing that seems to make it tricky is that the data is in an Excel table inside the Word document. Can this be done & if yes......how?