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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

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
 

Watch MrExcel Video

Forum statistics

Threads
1,130,182
Messages
5,640,668
Members
417,160
Latest member
Timon82

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