VBA Access to File>Properties>Comment

strorg

Board Regular
Joined
Mar 27, 2002
Messages
112
I would like to read / write the File>Properties>Comment field via VBA code. A friend at work gave me his bit of code, but I don't have it with me.

Thanks...Tom
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Tom,

Here is a procedure in where You find the wanted property:

<PRE>


Private Sub<FONT color=blue> Workbook</FONT>_BeforePrint(Cancel<FONT color=blue> As</FONT> <FONT color=blue>Boolean</FONT>)

<FONT color=blue>Dim </FONT>dSkapad<FONT color=blue> As</FONT><FONT color=blue> Date</FONT>

<FONT color=blue>Dim </FONT>dSparadSenast<FONT color=blue> As</FONT><FONT color=blue> Date</FONT>

<FONT color=blue>Dim </FONT>sForfattare<FONT color=blue> As</FONT><FONT color=blue> String</FONT>

<FONT color=blue>Dim </FONT>sForetag<FONT color=blue> As</FONT><FONT color=blue> String</FONT>

<FONT color=blue>Dim </FONT>sHyperLank<FONT color=blue> As</FONT><FONT color=blue> String</FONT>

<FONT color=blue>Dim </FONT>sKommentarer<FONT color=blue> As</FONT><FONT color=blue> String</FONT>



dSkapad = ThisWorkbook.BuiltinDocumentProperties("Creation<FONT color=blue> Date</FONT>")

dSparadSenast = ThisWorkbook.BuiltinDocumentProperties("Last Save Time")

sForfattare = ThisWorkbook.BuiltinDocumentProperties("Author")

sForetag = ThisWorkbook.BuiltinDocumentProperties("Company")

sHyperLank = ThisWorkbook.BuiltinDocumentProperties("Hyperlink Base")

sKommentarer = ThisWorkbook.BuiltinDocumentProperties("Comments")



<FONT color=blue>With </FONT>ActiveSheet.PageSetup

.LeftHeader = "Skapad: " & dSkapad

.RightHeader = "Skapad av: " & sForfattare & "/" & sForetag

.LeftFooter = "Sparad senast: " & dSparadSenast

.RightFooter = sKommentarer & vbCr & sHyperLank

<FONT color=blue>End With</FONT>



<FONT color=blue>End Sub</FONT>


</PRE>

It´s in swedish and I´m too lazy to convert it to chines :wink:

Kind regards,
Dennis
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,277
Members
449,093
Latest member
Vincent Khandagale

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