[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • Last Modified:

Diplaying the images from database on ms-word document

Dear All,

I am creating a Visual Basic application in which i am storing the images (binary format) in ms-access database. Along with the images i am also storing some text and information.

Now i want to retrieve them from the Database and need to display the information and image in ms-word document. Is it possible to do?

I am very thankful if anyone can give me the idea to do this.

Thanks and Regards

Sridhar

0
Cherukuri30
Asked:
Cherukuri30
  • 3
  • 2
1 Solution
 
Jaime OlivaresCommented:
Hi again, take a look to this previous question about inserting a picture in a Word document:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_10354042.html

Then, what you have to do is to retrieve picture from the Access database, save it in a temp file, and insert it into the document as described in the question.
0
 
Cherukuri30Author Commented:
i tried according to the above code i did not get any error message but image is not getting displayed in ms-word document.


Private Sub PictureToWord(DocName As String, PicturePath As String, Left As Integer, Top As Integer)
   Dim oWord As New Word.Application
    '/Then you want to open a new word document for which you will insert the image file
   Dim oDoc As Word.Document
    Set oDoc = oWord.Documents.Open(DocName)
    '/Now you insert the image in specific position
    Call oDoc.Shapes.AddPicture(PicturePath, False, True, Left, Top)
    '/To save the document with the image
    Call oDoc.SaveAs(DocName)
   oWord.Visible = True
End Sub

Private Sub Command1_Click()
Call PictureToWord("c:\images.doc", "c:\image.jpg", 100, 100)
End Sub


what could be possible mistake in the above
0
 
Jaime OlivaresCommented:
Have you tried the first code?
0
 
Cherukuri30Author Commented:
Thanks Jaime

I got it now, Thanks for your help and now i am gaining confidence. Hope i can seek your help in future too..

Regards

Sridhar
0
 
Jaime OlivaresCommented:
Thanks too, see you in next question.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now