View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ariel Ariel is offline
external usenet poster
 
Posts: 38
Default Using Excel VBA to create shape in Word

I am writing code in Excel that will create a report in Word. In one section,
I want to add a shape and send it to the back of a paragraph. The code works
fine when I run it in Word, but it doesn't work from my sub routine in Excel.
I obviously need to replace With "ActiveDocument" to something else but other
variables created earlier such as WdApp or WdDoc do not seem to work.

With ActiveDocument
.Shapes.AddShape Type:=msoShapeRectangle, _
Left:=60, Top:=120, Width:=500, Height:=150
.Shapes(1).Fill.ForeColor _
.RGB = RGB(Red:=205, Green:=216, Blue:=255)
.Shapes(1).Line.Visible = msoFalse
.Shapes(1).WrapFormat.AllowOverlap = True
.Shapes(1).WrapFormat.Side = wdWrapBoth
.Shapes(1).WrapFormat.Type = 3
.Shapes(1).ZOrder 5

End With