• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy paste an Excel table into Microsoft Word in a specific page with VBA

hansa

New Member
Hi

I am actually encountering an issue on VBA. My objective is to copy an excel table into a word document to a specific page number using VBA code.

Please check the uploaded file.

Thanks for your reply

Hansa
 

Attachments

  • code.txt
    1.2 KB · Views: 14
Hansa

Can you please attach the Excel file

If the code is adding the Table to an existing Word Document can you attach that as well

Also, What version of Office are you using ?
 
Hi Hui

Many thanks for your reply.

Please check attached Excel File. You will notice that there are three worksheets and I want to include these tables in a word document to a specific page..let's say I want to have one of the table on the third page and the other table on the fifth page.

Thanks
Hansa
 

Attachments

  • Copy of Template.xlsm
    25.5 KB · Views: 8
I also am interested to know how to do it. I am attaching two files of which I tried a short macro in the .docx file to do it, but it gives error, and I do not know what to do.

Oh, the website did not allow me to upload the .docx document that has my below macro:

Code:
Sub GetTable4()

'
'
  Dim XLSheet As Object
  Dim Wbook As String

' Create Sheet object
  Wbook = ThisDocument.Path & "\Criteria.xlsm"
  Set XLSheet = GetObject(Wbook, "Table 4")
'  "Table 4" is a tab name in the excel flie

' Copy data from sheet & paste to document
  XLSheet.Range("B3:C5").Copy
  Selection.Paste

  Selection.TypeParagraph

'  Kill the object
  Set XLSheet = Nothing

End Sub
 

Attachments

  • Criteria.xlsx
    8.6 KB · Views: 6
Hi, I too thinking how to to copy an excel table into a word document to a specific page number using VBA code.

Please help me to get a code for that.
 
Back
Top