Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending data from word to xl

Status
Not open for further replies.

nlbngr

Technical User
Nov 25, 2009
1
US
Hi all,

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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top