Create a new property for the current workbook.

  • Thread starter Thread starter Julian Milano
  • Start date Start date
J

Julian Milano

Is it possible to create a new property variable for a workbook while
running a macro in it?

I want something like "ThisWorkbook.MyCustomProperty = "Julian"
 
Julian,

Try something like the following:


Dim DocProps As DocumentProperties
Set DocProps = ThisWorkbook.CustomDocumentProperties
DocProps.Add Name:="NewProp", LinkToContent:=False, _
Type:=msoPropertyTypeString, Value:="New Value"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Thanks Chip.

--

Julian Milano


Chip Pearson said:
Julian,

Try something like the following:


Dim DocProps As DocumentProperties
Set DocProps = ThisWorkbook.CustomDocumentProperties
DocProps.Add Name:="NewProp", LinkToContent:=False, _
Type:=msoPropertyTypeString, Value:="New Value"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Back
Top