Solved

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

Posted on 2010-11-18
1
1,879 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need help Creating a Powershell script 8 95
using vb script 5 57
How to remove duplicates eficiently without sorting 5 57
dropdownlist in asp.net vb. 3 21
Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
Suggested Courses

734 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