Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Exporting Images from Word

Exporting Images from Word

Scheduled Pinned Locked Moved Visual Basic
helpgraphicscsharpdatabase
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ironclads
    wrote on last edited by
    #1

    Ok, I know what you are thinking. :doh: Why was this posted on the VB.Net forum? Well, let me explain. I Have a DHTML text editor that I currently import Microsoft Word documents into via IE. The only problem is only text comes across currently. I came across info on MSDN that said images can be saved out of Word 2003 as bmp files. So far I can open the document, get a handle on each image, and copy them to the clipboard, but for some odd reason, probably my fault :rolleyes:, I can't seem to save them to the hard drive. I've included the code below, perhaps you can assist, especially if you know MS VB.NET and VBScript better than I, which wouldn't be difficult to do. ;-) Basically I get the image copied to the clipboard fine but then I don't seem to be saving anything out. Nothing fails, it just doesn't save. Any help would be greatly appreciated. ;) Sub ImportWordDoc() On Error Resume Next Set wApp = CreateObject("Word.Application") wApp.Activate wApp.WindowState=0 call wApp.Resize(400, 400) Set wDoc = wApp.Documents.Open(document.all.FileToOpen.value) wApp.Visible = true For index = 1 To wDoc.InlineShapes.Count inlineShape = "" Set inlineShape = wApp.ActiveDocument.InlineShapes(index) inlineShape.Select() wApp.Selection.CopyAsPicture() data = "" Set data = Clipboard.GetDataObject() If data.GetDataPresent( GetType( System.Drawing.Bitmap )) Then bmp = "" bmp = CType(data.GetData(GetType(System.Drawing.Image)), Bitmap) bmp.Save( "C:\mybitmap" + cstr(index) + ".bmp" ) End If Next Call wDoc.Close(True) call wApp.Quit(True) End Sub

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups