A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
The code in question merely reverses the code from rich007a so that it will run from Excel rather than Word. I had assumed that you knew enough Excel VBA to tailor it to your needs.
It fills a range in an empty worksheet with 'testing' and then pastes that content to a Word document. If you want to copy the whole of an existing worksheet into Word, then you need to remove the code that fills the worksheet e.g.
Sub CopyToWord()
Dim wdApp As Object
Dim wdDoc As Object
Dim wdRng As Object
Dim xlWs As Excel.Worksheet
Dim xlRng As Excel.Range
Dim LastRow As Long
Dim LastCol As Long
On Error Resume Next
Set wdApp = GetObject(, "Word.Application")
If Err Then
Set wdApp = CreateObject("Word.Application")
End If
On Error GoTo 0
Set wdDoc = wdApp.Documents.Add(Visible:=True)
wdDoc.PageSetup.Orientation = 1 'landscape
Set xlWs = ActiveSheet
LastCol = xlWs.Cells(1, xlWs.Columns.Count).End(xlToLeft).Column
LastRow = xlWs.Range("A" & xlWs.Rows.Count).End(xlUp).Row
Set xlRng = xlWs.Range("A1", xlWs.Cells(LastRow, LastCol))
xlRng.Copy
Set wdRng = wdDoc.Range
wdRng.PasteSpecial Link:=False, _
DataType:=0, _
Placement:=0, _
DisplayAsIcon:=False
Set wdApp = Nothing
Set wdDoc = Nothing
Set wdRng = Nothing
Set xlWs = Nothing
Set xlRng = Nothing
End Sub
However, and this is a very big 'however', you are trying to paste a huge worksheet into a Word document and display it there. There is no way that is going to work (as you will see when you try it). You will get a tiny view and much of the sheet will be off the page.
The only way that you can copy such a large worksheet into a Word document would be to copy it in sections wide enough to fit on a page, either in Word landscape or portrait mode., and how big those sections need to be will be determined by what is in the Worksheet. If you tell me how many columns will fit on a Word page in either of those modes, I will tell you what extra is required to achieve this.
Also depending on what is in the worksheet and what the final aim is supposed to be, copying and pasting may not be the best approach. Directly transferring the content might be more appropriate.
If however you just want a link to the worksheet in a Word document, then that might be a more sensible approach. Change the two bold items i.e. 1 to 0 and False to True and that will store the worksheet with the document and put a link on the page.