Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using the Range Object in the AddPicture Method
Message
 
To
All
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Using the Range Object in the AddPicture Method
Miscellaneous
Thread ID:
00089410
Message ID:
00089410
Views:
81
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
Map
View

Click here to load this message in the networking platform