View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Word Document Object on excel Sheet

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