Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Saving MS Word Equations to bitmaps from VB

I am looking to write a VB6 program to go through a Microsoft Word document, find all the equation editor objects, and save the equations as bitmaps. Does anyone know if or how i can do this? Thanks.
0
melancholyeel
Asked:
melancholyeel
  • 3
1 Solution
 
Richie_SimonettiIT OperationsCommented:
Option Explicit
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Private Sub Form_Load()
Dim eq As InlineShape, i As Long
Set WordApp = New Word.Application
Set WordDoc = WordApp.Documents.Open("c:\test_eq.doc")

For Each eq In WordDoc.InlineShapes
    eq.Select
    WordApp.Selection.CopyAsPicture
    pic1.Picture = Clipboard.GetData(vbCFBitmap)
    SavePicture pic1.Picture, "c:\eq" & i & ".bmp"
    i = i + 1
Next
WordDoc.Close (False)
WordApp.Quit
Set WordDoc = Nothing
Set WordApp = Nothing
End Sub
0
 
Richie_SimonettiIT OperationsCommented:
or a more simple:

Option Explicit
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
Private Sub Form_Load()
Dim eq As InlineShape, i As Long
Set WordApp = New Word.Application
Set WordDoc = WordApp.Documents.Open("c:\test_eq.doc")

For Each eq In WordDoc.InlineShapes
    eq.Select
    WordApp.Selection.CopyAsPicture
    SavePicture Clipboard.GetData(vbCFBitmap), "c:\eq" & i & ".bmp"
    i = i + 1
Next
WordDoc.Close (False)
WordApp.Quit
Set WordDoc = Nothing
Set WordApp = Nothing
End Sub
0
 
melancholyeelAuthor Commented:
Thanks! It works great.
0
 
Richie_SimonettiIT OperationsCommented:
you are welcome. Thanks for "A" grade.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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