Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting an image in word and taking a print

Status
Not open for further replies.

itguru1

Programmer
Jun 18, 2001
12
US
how do i insert an image in a word(bmp,jpg) through an ole object of word that i created. and then how do i take a print out of this.
kindly help asap.
arun.
 
First of all you have to add bookmark in word document at the location you want your image to be inserted. Then use the following code:

myoleobject = CREATE OLEObject
myoleobject1 = CREATE OLEObject
myoleobject2 = CREATE OLEObject

myoleobject.application.Documents.Open("C:\MyDoc.doc")

myoleobject1.Bookmarks.Item[1].Select() //selecting the first book mark
myoleobject2 = myoleobject1.Bookmarks.Item[1].Range
myoleobject2.InlineShapes.AddPicture("C:\MyPic.bmp")
myoleobject1.save()
myoleobject1.close()
myoleobject.DisconnetObject()
myoleobject1.destroy()
myoleobject2.destroy()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top