jessitarexcel
Board Regular
- Joined
- Apr 6, 2022
- Messages
- 60
- Office Version
- 365
- Platform
- Windows
- Mobile
- Web
I have spent days now searching for a solution to this problem and none of the solutions I have found work. I really need help with this macro. It should work, I have written so many iterations it is ridiculous and have watched a heap of Youtube videos as well. Any assistance is sincerely appreciated. I have made sure that Microsoft and Microsoft Word Objects 16.0 is selected in references.
The text in red isn't working. Is it the name of the tab that is the issue?
This is the latest instance of the VBA and I will post the other versions I have tried in comments below this post.
The text in red isn't working. Is it the name of the tab that is the issue?
This is the latest instance of the VBA and I will post the other versions I have tried in comments below this post.
Dim wordObject As Object
Dim wordDocument As Object
Dim wordTable As Object
Application.ScreenUpdating = False
Application.EnableEvents = False
ThisWorkbook.Worksheet(COW and Stat Dec Table.Name).ListObjects("StatDecTable").Range
On Error Resume Next
Set WordApp = GetObject(class:="Word.Application")
If WordApp Is Nothing Then Set WordApp = CreateObject(class:="Word.Application")
Set pageEditor = xInspect.WordEditor
WordApp.Visible = True
WordApp.Activate
WordApp.Documents.Open "Link Removed for Privacy" (The link does work and the right word document opens but it won't paste the table)
Stat Dec and COW Table - New.Range("StatDecTable"[#All]").Copy
mydoc.Paragraphs(1).Range.PasteExcelTable_
LinkedtoExcel = False, _
WordFormatting = False, _
RTF: = False
Application.ScreenUpdating = True
Application.EnableEvents = True
Set pageEditor = Nothing
'Clear the clipboard
Application.CutCopyMode = False
End Sub