Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Export data from excel into an existing word document

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Export data from excel into an existing word document


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Export data from excel into an existing word document


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export excel data to word document mda19652 Excel Discussion (Misc queries) 1 November 1st 07 12:01 PM
Export spreadsheet data to PDF or Word document Kim Jespersen Excel Programming 1 August 6th 06 10:16 AM
How do I export an Excel graph into a word document? jennyb Excel Discussion (Misc queries) 1 September 29th 05 05:48 PM
how do I transfer information from excel to an existing word document using a macro sweetiez1114 Excel Programming 1 July 12th 05 01:38 PM
convert existing Excel into Data source document to link to exist. KayLMPD Excel Discussion (Misc queries) 1 March 29th 05 12:37 PM


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"