Adding Custom property
Thanks. Could you then tell me the value for msoPropertyTypeNumber? When I
debug the code the value for msoPropertyTypeNumber is empty. Could explain
the error, but I found no value table in XL Help and therefore can't try to
change to an absolute value.
Joerg
"Vergel Adriano" wrote in message
...
Not much of an answer, but, wanted to let you know that your code worked
for
me as well. I have xl2003. The only problem I had was that it errors out
the second time I run it because the property already exists by then.
"Joerg" wrote:
Thanks for your quick reply. Property doesn't exist. If created
manually,
then using it (e.g.
ActiveWorkbook.CustomDocumentProperties("NumberOfS heets") =
ActiveWorkbook.Sheets.Count)
works fine. Just creating it with VBA is the problem. I'm using XL2003.
Joerg
"NickHK" wrote in message
...
Joerg,
Your code works for me in XL2002, but I have had difficulties
sometimes
working with this collection.
Make sure this property does not already exist
Close the WB, open it again and try the code.
NickHK
"Joerg" wrote in message
...
Hello World!
How can I add a custom property to the active workbook? Following
code
looks
OK to me, but produces a run-time error (invalid procedure call or
argument):
ActiveWorkbook.CustomDocumentProperties.Add
Name:="NumberOfSheets",
_
LinkToContent:=False, _
Type:=msoPropertyTypeNumber, _
Value:=ActiveWorkbook.Sheets.Count
Thanks,
Joerg Mochikun
|