View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Piping data to other office applications

Take a look at this:
http://word.mvps.org/FAQs/InterDev/C...WordFromXL.htm

This too:
http://addbalance.com/usersguide/fields.htm

And this:
http://gregmaxey.mvps.org/Word_Fields.htm

Finally, once you get the DocVariable fields set up in Word (hit Alt + F9 to
see all fields), run this code from Excel.
Sub PushToWord()

Dim objWord As New Word.Application
Dim doc As Word.Document
Dim bkmk As Word.Bookmark
sWdFileName = Application.GetOpenFilename(, , , , False)
Set doc = objWord.Documents.Open(sWdFileName)

With doc
..Variables("VarNumber1").Value = Range("VarNumber1").Value
..Variables("VarNumber2").Value = Range("VarNumber2").Value
'etc
..Range.Fields.Update
End With

'ActiveDocument.Fields.Update

objWord.Visible = True

End Sub

Note: This code runs in Excel; pushes Excel variables (assigned as Named
Ranges) to Word.

Regards,
Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"CellShocked" wrote:

You failed to see the requisite. Must use existing word document.

I already know how to paste an excel table into word. All I want to do
is paste excel data into an *existing* word document.

I will simply have to construct the entire Word document in Excel if
there is no way to pass the data over.

At that point, (recreating the entire document) the word document would
no longer be needed.

Getting them to incorporate it at work is a different story, however.



On Thu, 10 Dec 2009 20:56:57 -0800 (PST), marcus
wrote:

Hi

Rather than using vb to bring the data in where the formatting can be
no always reliable (particualarily the curning of the words). Why not
use a link between XL and Word. Copy your table in XL, now open your
word document in the place the cursor where you want your table.

Goto Edit - PasteSpecial -

On the form select - Microsoft Office Excel Worksheet Object

Click the Paste Link radio button.

Now when ever your XL sheet changes so will your Word document change
to reflect the changes in XL.

Take care

Marcus

.