View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Adding and Changing 'CustomDocumentProperties' from VBA on other f

MS provides a DLL to support this. Unfortunately this article has been
updated to reflect .Net, but the DLL should still work from VBA i would
think

http://support.microsoft.com/default...b;en-us;224351


Here is some information I posted in 1999

===============
Leo,
I think you are trying too hard. In Excel97, I went into the VBE and into
Tools=References and created a reference to the DSOFile.dll using the
browser.

Then the following code worked fine:

Sub TestDSOFILE()
Dim docProp As DSOleFile.DocumentProperties
Set docProp = PropertyReader.GetDocumentProperties( _
sFilename:="Y:\docs\Excel_quit.xls")
Debug.Print docProp.AppName
Debug.Print docProp.Author
Debug.Print docProp.Name
End Sub

It returned the following
Microsoft Excel
Thomas W. Ogilvy
Excel_quit.xls

Once you have the reference, you can use the object browser to see what
other properties are available.

HTH,
Tom Ogilvy
===============
Of course it needs to be registered with regsvr32

in code
Shell "RegSvr32 ""C:\Winnt\system32\DSOFILE.dll"" /s "

depending on where you placed the file.

if you are willing to open it:

http://www.cpearson.com/excel/docprop.htm
at Chip Pearson's site.



--
Regards,
Tom Ogilvy

"VBA Dabbler" <VBA wrote in message
...
Does anyone know the VBA code to add or change a 'CustomDocumentProperty'

in
an Office document at the file level without opening the document?

Assume that the VBA code will be running in an Excel workbook.