View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chad Knudson Chad Knudson is offline
external usenet poster
 
Posts: 2
Default Embedded Word Document not painted until I click on it and activate it with the mouse

Found out that I needed to activate it after putting in all of the content
into the doc to force it to paint.


"Chad Knudson" wrote in message
...
I'm generating reports in Excel and one of them has an embedded Word
document. I can create the embedded Word document just fine but I don't

end
up with the document painting in Excel, I have just a white box. If I

click
on the embedded Word document to activate it, all of my text is there and
clicking away leaves me with the desired result. What am I missing to get
Word to paint this? I'm inside a section that has Excel's
Application.ScreenUpdating = False in case that affects anything.

(wsReports is an Excel worksheet)

Dim shpEmbeddedWordDoc As Shape
Dim objWord As Object

Set shpEmbeddedWordDoc=
wsReports.Shapes.AddOLEObject(ClassType:="Word.Doc ument.8", Left:=334#,
Top:=4977#, Width:=320#, Height:=144#)
Set objWord = wsReports.OLEObjects(1).Object

objWord.Activate
objWord.StoryRanges(1).Text = "This is the contents of the document"

I seem to be missing something to get this to initially draw.