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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

XL-Dennis

Well-known Member
Joined
Jul 27, 2002
Messages
1,920
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,642
Messages
5,832,836
Members
430,171
Latest member
Ashish7860

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
Top