Change comment in VBA module when workbook opens

Phil Smith

Active Member
Joined
Aug 13, 2004
Messages
285
Office Version
  1. 365
Platform
  1. Mobile
Hi everyone.

Is it possible to change a comment line within a module to use a variable?

I have a comment in one of my workbooks that is "Working on this project 2008-2010".

If it is possible, when the workbook is opened, I would like the comment line to be changed so that it takes into account Year(Now) instead of showing a static "2010".

I would take a guess that it is not possible, but am prepared to be stunned by the expertise of the board members.

Thanks.

Phil
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Thanks for the reply.

Looked at that page and I sensed I would be getting in WAY over my head.

Guess I will just have to remember to change it manually as & when I need to!

Thanks for the prompt reply though!
 
Upvote 0
Click on the File tab. On the right of that screen there are Properties listed, including Last Modified, which is the date/time that the file was last saved.

If it is possible, when the workbook is opened, I would like the comment line to be changed so that it takes into account Year(Now) instead of showing a static "2010".
It sounds like that is the value that you want "saved" in the VB module comment.
 
Upvote 0
And is it possible to "save" that information to a comment line within a module? And all I need is the current year as I said in my first post.

Thanks.
 
Upvote 0
My point is that that value is automaticaly saved with the workbook. There is no need to save it to a comment in a module, its already saved to the Last Modified property.

Especially since modifying the comments in a code module requries a certain level of Trust Access.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,896
Members
452,948
Latest member
Dupuhini

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