Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Setting the SAVE PREVIEW PROPERTY for all workbooks on a volume & for New workbooks

2 views
Skip to first unread message

Sacha Vieux-Roy

unread,
Feb 20, 2002, 1:18:23 PM2/20/02
to
On the File menu the Properties command displays a dialog for setting
properties for the active file.

When the Save Preview Picture property is checked, a picture of the first
page is saved. This picture is displayed when previewing the document in the
Open/Save dialog and when viewing a windows explorer window with Thumbnails.

I would like to set the Save Preview Picture property to TRUE for all Excel
& Word documents on my C drive programmatically.

I would like configure the Book.xlt file & the Normal.dot file to create
Excel/Word documents with the Save Preview Picture property set to TRUE by
default. I am able to configure Excel to set the Save Preview Picture
property by default for NEW Workbooks. I am NOT able to configure Word to
set the Save Preview Picture property by default for NEW documents. If I
rename the Normal.dot file to xxx.dot the template opens a new document with
the Save Preview Picture property set to TRUE.

Because I can't find support for setting the Save Preview Picture property
programmatically in the Excel object model, I am using the SendKey method.
The macro below works when executed on the current workbook. When I try to
iterate through all workbooks on my C drive & execute the
ToogleSavePreviewPicture macro on each workbook, the Save Preview Picture
property is NOT set.

The macro TooglePreviewPicture listed below works when executed on the
active workbook. When I iterate through all workbooks on my C drive &
execute the TooglePreviewPicture macro against each workbook, the Save
Preview Picture is NOT set. If I halt the macro before the Property dialog
is dismissed, the Save Preview Picture property is checked. If I halt the
macro right after the Property dialog is dismissed, the Save Preview Picture
property is NOT checked.


Sub ToggleSavePreviewPicture()

' Sends ALT+F to open the File menu.

SendKeys ("%f"), True

' Sends ALT+I to open the Properties dialog box and displays the

' Summary tab.

SendKeys ("i"), False

' Selects the Save Preview Picture check box.

SendKeys ("%v"), True

End Sub

Sub TooglePrpSPPForAllWorkbooks(ThisFolder)

Dim File

Dim Folder

Dim System As FileSystemObject

Set System = New FileSystemObject

On Error Resume Next

For Each File In System.GetFolder(ThisFolder).Files

If File.Type = "Microsoft Excel Worksheet" Then

Workbooks.Open File.Path

ToggleSavePreviewPicture

Workbooks(File.Name).Close True

End If

Next 'File

For Each Folder In System.GetFolder(ThisFolder).SubFolders

For Each File In Folder.Files

If File.Type = "Microsoft Excel Worksheet" Then

Workbooks.Open File.Path

ToggleSavePreviewPicture

Workbooks(File.Name).Close True

End If

Next 'File

Call TooglePrpSPPForAllWorkbooks (Folder)

Next 'Folder

End Sub

0 new messages