DSO File Properties

DonkeyOte

MrExcel MVP
Joined
Sep 6, 2002
Messages
9,124
Anybody know the index list for custom properties? (a list of n)?

eg

DSO.GetDocumentProperties(P).CustomProperties.Item(n)

If not, does anyone know if it's at all possible to determine (from VBA) as to whether or not a word.doc has the "Save Preview Picture" property activated within the file properties? (Apparently this can add 3MB to a doc file). Better still, anyone know if this can be toggled?[/i]
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Luke,

Long time no see. How's it going?

This code seems to work ok:-

<pre><FONT COLOR="#00007F">Option</FONT> <FONT COLOR="#00007F">Explicit</FONT>


<FONT COLOR="#00007F">Sub</FONT> GetProps()
<FONT COLOR="#00007F">Dim</FONT> DSO <FONT COLOR="#00007F">As</FONT> DSOleFile.PropertyReader, olePic <FONT COLOR="#00007F">As</FONT> StdPicture
<FONT COLOR="#00007F">Dim</FONT> vFilename <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Variant</FONT>


vFilename = Application.GetOpenFilename("All Files,*.*", , "Choose a file...")
<FONT COLOR="#00007F">If</FONT> vFilename = <FONT COLOR="#00007F">False</FONT> <FONT COLOR="#00007F">Then</FONT> <FONT COLOR="#00007F">Exit</FONT> <FONT COLOR="#00007F">Sub</FONT>


<FONT COLOR="#00007F">Set</FONT> DSO = <FONT COLOR="#00007F">New</FONT> DSOleFile.PropertyReader


<FONT COLOR="#007F00">'The code will error if there is no preview</FONT>
<FONT COLOR="#00007F">On</FONT> <FONT COLOR="#00007F">Error</FONT> <FONT COLOR="#00007F">Resume</FONT> <FONT COLOR="#00007F">Next</FONT>
<FONT COLOR="#00007F">Set</FONT> olePic = DSO.GetDocumentProperties(vFilename).Thumbnail


<FONT COLOR="#00007F">If</FONT> olePic <FONT COLOR="#00007F">Is</FONT> <FONT COLOR="#00007F">Nothing</FONT> <FONT COLOR="#00007F">Then</FONT>
MsgBox vFilename & " has no preview image."
<FONT COLOR="#00007F">Else</FONT>
MsgBox vFilename & " has a preview image."
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">If</FONT>


<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>
</pre>
 
Upvote 0
Dan - again thanks - do you know if you can control the toggle on this property from XL (ie turn it off if the preview exists)?

Cheers

As for long time no see...I am keeping a low profile! (Perhaps I should work when I am at work :wink: ???)
 
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,322
Members
451,696
Latest member
Senthil Murugan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top