shape

G

gan

Hi,

Please could someone show me how to load a jpg image
residing in a Word document into the VB6 PictureBox
control without lowering the image quality?

I tried this on a Word document with one inline JPG
picture.

Private Sub LoadWordPictureIntoPictureBox()
Dim WDoc as Word.Document
Dim WIShape As Word.InlineShape
Set WDoc = Word.Documents.Open("Doc with JPG.Doc")
'Reference the JPG image
Set WIShape = WDoc.InlineShapes(1)
'Copy image to clipboard
WIShape.Range.CopyAsPicture
'Put the picture in the VB PictureBox
Me.Picture1.Picture = Clipboard.GetData
End Sub

It works except that the VB PictureBox image quality is
rather poor compared to Word version. The VB PictureBox
works fine when I load the same image from file (.jpg).

Thanks in advance
 
G

Guest

This loaded the copied image properly.
Me.Picture1.Picture = Clipboard.GetData(vbCFMetaFile)
 
C

Cindy M -WordMVP-

Hi Gan,

Is the picture LINKED into the Word document, so that you
could load it from a file saved to disk?
Please could someone show me how to load a jpg image
residing in a Word document into the VB6 PictureBox
control without lowering the image quality?

I tried this on a Word document with one inline JPG
picture.

Private Sub LoadWordPictureIntoPictureBox()
Dim WDoc as Word.Document
Dim WIShape As Word.InlineShape
Set WDoc = Word.Documents.Open("Doc with JPG.Doc")
'Reference the JPG image
Set WIShape = WDoc.InlineShapes(1)
'Copy image to clipboard
WIShape.Range.CopyAsPicture
'Put the picture in the VB PictureBox
Me.Picture1.Picture = Clipboard.GetData
End Sub

It works except that the VB PictureBox image quality is
rather poor compared to Word version. The VB PictureBox
works fine when I load the same image from file (.jpg).

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top