Solved

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

Posted on 2010-11-18
1
1,775 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

815 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

10 Experts available now in Live!

Get 1:1 Help Now