View Single Post
 
Old 11-14-2014, 07:42 AM
ChrisBrewster ChrisBrewster is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: Jan 2014
Posts: 36
ChrisBrewster is on a distinguished road
Default Saving graphics using captions

I need to save the graphics in Word files, using an altered version of each figure's caption for the file name. VBA doesn't have a function like the "Save Picture As" function (on the menu when you right-click a graphic), which is how I thought I would create a macro. I hunted around and found a very good script, which is attached. It puts the figure captions in an array, saves the Word file as HTML in a new folder, deletes non-graphic files from that folder, and assigns the captions as file names for the graphic files.

This script does everything I need, except that it works only on PNG files. JPG files are saved, but with numbered file names. (The critical step for naming the file specifies the ".png" extension.) My VBA knowledge isn't good enough to modify this script. Can anyone suggest how to change it so that it detects the file type, and makes the correct caption for either JPG or PNG?

The script is in the attached file, and I found it at this link:

http://www.mrexcel.com/forum/general...le-folder.html
Attached Files
File Type: txt VBA macro - Extract Word graphics.txt (3.7 KB, 12 views)
Reply With Quote