PDA

View Full Version : Can we Batch Change "save preview picture" setting?



rapidcad
04-17-2006, 10:38 AM
HI, I'm a little out of my element in this forum, since I've only dabbled in VBA once by tweaking another's program. However, when I ran cross this forum, I thought I'd better ask here.

I've got a problem that I think VBA is likely the solution for. This is a Microsoft Word problem. I don't want to waste everyone's time here, but I know that the people who frequent this forum would either know the answer, or could point me to a site where I could get one.

Here is the issue... I recently noticed that when one setting is on in any word document with an image attached, it balloons in size if the "save preview picture" check box is selected on the Files-> Properties pull down menu.

Here's what I need to figure out. Can this setting be accessed and changed with VBA in some kind of batch that can run on our network? I'd like to have a batch open every word doc, change that setting to "no" (uncheck it), save the file, close it and move on to the next.

So, is this something VBA can do? Where would I go to get a solution for this problem?

Thanks for any help on this.

TonyJollans
04-17-2006, 01:11 PM
Unfortunately, no.

The only way to access this setting frm VBA is with the somewhat unreliable SendKeys - and you can't query the value at all, all you can do is toggle it.

jfriborg
11-22-2006, 03:18 AM
There's another possibility...
Slightly more complex, but it works.

Example: Turn on 'Save preview picture' in a Word document using VBA / COM

- Create Word application object
- Open the file as a Word document
- Save the file as a XML document and close the file
- Open the XML document using a XmlDocument object using a namespace
- Add the <w:savePreviewPicture> element to the <w:wordDocument>...<w:docPr> structure if it's not present (save a Word document as a XML file and view the XML file in XML spy or a similar tool to see the structure details)
- Save the XML file
- Open the XML file using the Word application object
- Save the XML file as a Word document and close the file

=> The Word document is saved with a preview picture

I'm developing a Window service mechanism to extract preview images from Office documents and can't trust the SendKeys mechanism.