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.
HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
"Peter T" wrote:
I don't know much about Word but this worked for me -
Sub test()
Dim sText As String
Dim ole As OLEObject, obj As Object, objWdSection As Object
Set ole = ActiveSheet.OLEObjects("Object 1") ' or say "Object 1"
Set obj = ole.Object
If TypeName(obj) = "Document" Then
Set objWdSection = obj.sections(1)
sText = objWdSection.Range.Text
MsgBox sText
End If
End Sub
Regards,
Peter T
"K" wrote in message
...
I have an Word Document object " EMBED("Word.Document.12","") " on my
excel worksheet. How can I copy text from Word.Document Object onto
excel sheet by VBA. Is there some code like "Range("A1").value =
Word.Document.Object.Value". I just want to know how can i reference
something with Word Document Object on excel sheet by VBA. Please can
any friend help