Solved

VBA Script to Convert all Images from eps to jpg or png

Posted on 2010-11-18
1
1,681 Views
Last Modified: 2012-05-10
Hi,

My company has a few hundred word documents with eps images in them. Recently we became aware that these documents do not work correctly in Word 2008 for mac, because of an updated EPS filter or similar causing the images to be displayed improperly. I am looking for a VBA Script to read the document and convert the EPS files to a different format like JPG, PNG, or even WMF I guess, so that Word 2008 on mac can use these documents.

I am open to using other languages to perform this task as well, I just figured that VBA would be better suited to it as it is built into the office suite.

The documents were created in Word 2003
0
Comment
Question by:jrm213jrm213
1 Comment
 
LVL 17

Accepted Solution

by:
jrm213jrm213 earned 0 total points
Comment Utility
Ok, well I was able to write a script to accomplish this in an acceptable manner so that Word 2008 for Mac can now properly open and print these files. I just have to run this script on each document.

You probably don't need the IconLabel or the i variable, I was just using them to count how many items I replaced to make sure it got all the images.
Dim oIshp As InlineShape

  Dim oshp As Shape

  Dim i As Integer

  

  i = 0

    For Each oshp In ActiveDocument.Shapes     

        With oshp

            If (oshp.Type = 11) Then

            i = i + 1

                oshp.Select

                ActiveWindow.Selection.CopyAsPicture

                ActiveWindow.Selection.Range.PasteSpecial datatype:=wdPasteEnhancedMetafile, IconLabel:="moved" + Str(i)

                ActiveDocument.Shapes(ActiveDocument.Shapes.Count).Top = oshp.Top

                ActiveDocument.Shapes(ActiveDocument.Shapes.Count).Left = oshp.Left

                oshp.Delete

            End If

            

           

        End With

    Next oshp

Open in new window

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now