Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm looking to export several tables from excel into an existing word document using VBA. I know how to create a new word document and insert data into it using hardcoding however i don't know how to open a word document and actually export tables created in excel. If anyone could point me in the right direction I would really appreciate it! Cheers |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() In Excel VB Editor, click on Tools, References and tick M/soft Word Objects. Then use following: Sub WriteToWord() Dim objWord As New Word.Application Dim objDoc As Word.Document Set objDoc = objWord.Documents.Add("letter.dot") 'miss out brackets and template name if just want to add normal document With objWord (in Word, use macro recorder to record steps to paste special Excel data then copy and paste these steps in here with a full stop in front of each) End With objWord.Visible = True 'default is to keep Word invisible Set objDoc = Nothing Set objWord = Nothing End Sub "CJJ" wrote: Hi, I'm looking to export several tables from excel into an existing word document using VBA. I know how to create a new word document and insert data into it using hardcoding however i don't know how to open a word document and actually export tables created in excel. If anyone could point me in the right direction I would really appreciate it! Cheers |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() This may help: http://word.mvps.org/faqs/InterDev/C...WordFromXL.htm Also: http://www.mrexcel.com/articles/excel-to-word-macro.php The second link may be more helpful in this scenario. One more, just for fun: http://www.erlandsendata.no/english/...olecontrolword HTH, Ryan--- -- Ryan--- If this information was helpful, please indicate this by clicking ''Yes''. "Smallweed" wrote: In Excel VB Editor, click on Tools, References and tick M/soft Word Objects. Then use following: Sub WriteToWord() Dim objWord As New Word.Application Dim objDoc As Word.Document Set objDoc = objWord.Documents.Add("letter.dot") 'miss out brackets and template name if just want to add normal document With objWord (in Word, use macro recorder to record steps to paste special Excel data then copy and paste these steps in here with a full stop in front of each) End With objWord.Visible = True 'default is to keep Word invisible Set objDoc = Nothing Set objWord = Nothing End Sub "CJJ" wrote: Hi, I'm looking to export several tables from excel into an existing word document using VBA. I know how to create a new word document and insert data into it using hardcoding however i don't know how to open a word document and actually export tables created in excel. If anyone could point me in the right direction I would really appreciate it! Cheers |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Export excel data to word document | Excel Discussion (Misc queries) | |||
Export spreadsheet data to PDF or Word document | Excel Programming | |||
How do I export an Excel graph into a word document? | Excel Discussion (Misc queries) | |||
how do I transfer information from excel to an existing word document using a macro | Excel Programming | |||
convert existing Excel into Data source document to link to exist. | Excel Discussion (Misc queries) |