Solved

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

Posted on 2010-11-18
1
1,750 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
ID: 34167435
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…

863 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

25 Experts available now in Live!

Get 1:1 Help Now