LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Refer to customproperty by name?

It's in XP too Nick.

--
HTH

Bob Phillips

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

"NickHK" wrote in message
...
Helmut,
Whilst Help does mention the DocumentProperties collection, I find nothing
on the CustomProperties collection, for XL2K.
You code will not compile on my version, as I now see this is a XL2003
feature designed to work with XML :

http://msdn.microsoft.com/library/en...asp?frame=true

So I guess Item can only return the Property value by Index, not by
key/name.
As I don't have this version of Excel, I can you much.

NickHK

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

what is confusing me is that there is without any doubt
not only a CustomDocumentProperties collection,
but a CustomProperties collection as well.

Sub Test00023()
Dim oSht As Worksheet
Dim oPrt As Property
Dim bFnd As Boolean
Dim lPrt As Long
Set oSht = ActiveSheet
bFnd = False
For lPrt = 1 To oSht.CustomProperties.Count
If oSht.CustomProperties(lPrt).name = "x" Then
bFnd = True
End If
Next
If bFnd = False Then
ActiveSheet.CustomProperties.Add name:="x", Value:=1
End If
On Error Resume Next
MsgBox ActiveSheet.CustomProperties("x").Value ' Type mismatch
If Err.Number 0 Then
MsgBox Err.Number & " = " & Err.Description
End If
MsgBox ActiveSheet.CustomProperties(1).Value ' ok
End Sub

- It is the "CustomDocumentProperties" collection.
- The collection is part of the Workbook, not Worksheet object.


Whereas the CustomProperties collection seems to be
a part of the worksheet object.

I was wondering, whether a CustomProperty
can, seemably, not be addressed by name,
and what a name at all would be good for, then.

Not that I couldn't work around it, no problem at all.

I was just curious about an apparently
faulty design of the CustomProperties collection.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"










 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I refer to a row Mark F[_2_] New Users to Excel 2 July 7th 11 05:29 PM
How to refer a name in VBA clara Excel Discussion (Misc queries) 4 June 26th 08 12:27 AM
Refer to value strikeuk Excel Discussion (Misc queries) 8 May 17th 06 08:42 AM
refer indirectly to Name Hershmab Excel Worksheet Functions 5 March 24th 06 04:30 PM
refer JE McGimpsey Excel Discussion (Misc queries) 2 November 28th 05 06:55 PM


All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"