General information
Category:
Coding, syntax & commands
Title:
Using the Range Object in the AddPicture Method
Hi there,
I'm trying to control a Word document from VFP via VBA, and so far have been fairly successful. However, when I try to use the AddPicture method for InlineShapes, I am unsuccessful in specifying the range between two bookmarks where the picture will be placed in the document. I either get a syntax error or the picture is placed at the beginning of the document.
Here is the code I'm using to place the picture in the specified range:
this.dv_oOleApp.ActiveDocument.Bookmarks.Add("ACG_BEGIN_PICTURE")
this.dv_oOleApp.Selection.TypeText("This is where the picture will go")
this.dv_oOleApp.ActiveDocument.Bookmarks.Add("ACG_END_PICTURE")
this.dv_oOleApp.ActiveDocument.Range(this.dv_oOleApp.ActiveDocument.Bookmarks("ACG_BEGIN_PICTURE").Range.Start, ;
this.dv_oOleApp.ActiveDocument.Bookmarks("ACG_END_PICTURE").Range.Start)
this.dv_oOleApp.ActiveDocument.InlineShapes.AddPicture("y:\users\ben\wwwinappr\prop1.jpg",.t.,.t.,this.dv_oOleApp.ActiveDocument.Range)
What am I doing wrong?
Thanks,
Ben Holton
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only