Copy Excel table to Word with VBA

Barb Henderson
Barb Henderson
12.6 هزار بار بازدید - 2 سال پیش - Copy Excel table to Word
Copy Excel table to Word with VBA.  Send a filtered Excel table to Word
Free templates and templates  with code are available for purchase for $50 USD
https://www.easyexcelanswers.com/temp...

Contact me regarding customizing this template for your needs.

Click for online Excel Consulting http://www.calendly.com/easyexcelanswers

I am able to provide online help on your computer at a reasonable rate.

https://www.amazon.com/shop/barbhende...

I use a Blue condenser Microphone to record my videos, here is the link
https://amzn.to/37gyyGa

Check out Crowdcast for creating your webinars
https://app.linkmink.com/a/crowdcast/83

I use Tube Buddy to help promote my videos
Check them out
https://www.Tubebuddy.com/easyexcelan...

Follow me on Facebook
Facebook: easyexcel.answers

TWEET THIS VIDEO Copy Excel table to Word with VBA

Follow me on twitter
easyexcelanswers

IG @barbhendersonconsulting

You can help and generate a translation to you own language
http://www.youtube.com/timedtext_cs_p...

*this description may contain affiliate links. When you click them, I may receive a small commission at no extra cost to you. I only recommend products and services that I've used or have experience with.

code
Sub copytabletoword()
Dim tbl As Excel.Range
Dim newdoc As Word.document
Dim wordObject As Object
Dim wordDocument As Object
Dim wordTable As Object

Application.ScreenUpdating = False
Application.EnableEvents = False

Set tbl = ThisWorkbook.Worksheets(Sheet1.Name).ListObjects("Table1").Range

On Error Resume Next
If WordApp Is Nothing Then Set WordApp = CreateObject(class:="Word.Application")

Set pageEditor = xInspect.WordEditor
WordApp.Visible = True
WordApp.Activate
 
Set newdoc = WordApp.Documents.Add
 
Sheet1.Range("Table1[#All]").Copy
newdoc.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
2 سال پیش در تاریخ 1400/12/29 منتشر شده است.
12,673 بـار بازدید شده
... بیشتر