Search the web
Sign In
New User? Sign Up
helpwithvb · A group for those who need help with Visual Basic
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Extracting image from Word   Message List  
Reply | Forward Message #22035 of 22566 |
Re: Extracting image from Word

--- In helpwithvb@yahoogroups.com, "allan_blackford" <allan_blackford@...>
wrote:
>
> How do I go about extracting an image from a word file?
>
It took a while but I finally found enough resources to figure it out. This
must not be a popular subject, since I couldn't find much at all, along with no
repsonses here. Anyway, if anyone wants the vb.net code, here ya go. It may not
be pretty, but it works.

Dim x As Integer
Dim wordAp As New Word.Application
Dim doc As Word.Document
Dim picShape As Word.InlineShape
Dim image As Bitmap

'open word file and keep it hidden
doc = wordAp.Documents.Open(dlgFilePath.FileName, ReadOnly:=True)
doc.ActiveWindow.Visible = False

'array to for images
x = doc.InlineShapes.Count
Dim aryImages(x - 1) As Bitmap


'get shapes from word file
For x = 0 To doc.InlineShapes.Count - 1

picShape = doc.InlineShapes.Item(x)

'select shape and copy as picture to clipboard
picShape.Select()
wordAp.Selection.CopyAsPicture()

'get image from clipboard and put in array
image = Clipboard.GetImage
aryImages(x) = image
Next

'close word file
doc.Close()

frmImages.Show()





Thu Jun 18, 2009 8:46 pm

allan_blackford
Offline Offline
Send Email Send Email

Forward
Message #22035 of 22566 |
Expand Messages Author Sort by Date

How do I go about extracting an image from a word file?...
allan_blackford
Offline Send Email
Jun 10, 2009
11:32 pm

... It took a while but I finally found enough resources to figure it out. This must not be a popular subject, since I couldn't find much at all, along with...
allan_blackford
Offline Send Email
Jun 18, 2009
8:46 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help