View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Refer to customproperty by name?

You can do the same in Excel with CustomDOCUMENTProperties

ActiveWorkbook.CustomDocumentProperties.Add Name:="x", _
LinkToContent:=False, Type:=msoPropertyTypeNumber, Value:=1

MsgBox ActiveWorkbook.CustomDocumentProperties("x").Value ' Type mismatch
MsgBox ActiveWorkbook.CustomDocumentProperties(1).Value ' ok



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Helmut Weber" wrote in message
...
Hi everybody,

is there something wrong with this code
or is something wrong with Excel?

'ActiveSheet.CustomProperties.Add Name:="x", Value:=1 ' ok

MsgBox ActiveSheet.CustomProperties("x").Value ' Type mismatch
MsgBox ActiveSheet.CustomProperties(1).Value ' ok

In Word I can refer to a customdocumentproperty by name.
MsgBox ActiveDocument.CustomDocumentProperties("x").Value ' ok

--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000 (german versions)