I am using a word macro to open an excel file and copy a range, and to paste that as a table in my word document. Everything works great except that it pastes onto page 1 and not page 6 (where I need it). The one option is to change the paragraph number until I find my way to page 6 but is there any other way (I tried paragraph number 243 and it posted in the middle of page 5). The paragraph number in WordCount doesn't correspond. Please assist and thanks in advance.
Sub CopyExcelPasteWord()
Dim objExcel As New Excel.Application
Dim exWb As Excel.Workbook
Dim tbl As Excel.Range
Dim WordTable As Word.Table
Set exWb = objExcel.Workbooks.Open("C:\Users\a222012\Desktop\Standard Bank\2017\FASS\CSS Project\Cash Shared Services\Fees_Contract.xlsm")
Set tbl = exWb.Sheets("Device_Selection").Range("A5:G26")
tbl.Copy
Selection.GoTo wdGoToPage, wdGoToAbsolute, 6 'Go to page 6
ThisDocument.Paragraphs(1).Range.PasteExcelTable LinkedToExcel:=False, _
WordFormatting:=False, RTF:=False
Set WordTable = ThisDocument.Tables(1)
WordTable.AutoFitBehavior (wdAutoFitWindow)
exWb.Close
Set exWb = Nothing
End Sub
ThisDocument.Paragraphs(1).Range.PasteExcelTable
just useThisDocument.Bookmarks("BookMark_Name").Range.PasteExcelTable
– KoderM16