View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Thorsten Walenzyk Thorsten Walenzyk is offline
external usenet poster
 
Posts: 10
Default Storing various data in .ID property

Thanks a lot Alan.

I heared about that behaviour before and it is ok for me, because I don't
need the data stored permanently...

Thorsten


"Alan" wrote in message
...
"Thorsten Walenzyk" wrote in
message ...

Hi all,

I asked how to store additional data per some cells in my Table.
I've got the hint, that I can use the .ID property for storing

single
data.

But I need to store various data.

I tried something like this:

Public Type MyType
somedata As Integer
someother As String
End Type

Private Sub test()
Dim CellData As MyType
CellData.somedata = 42
CellData.someother = "fourty-two"

Sheets(1).Cells(2, 2).ID = CellData
End Sub


But I've got the error:
"Only user-defined types defined in public object modules can be
coerced to or from a variant or passed to late-bound functions"

As I have defined MyType as a Public type, I guess the problem is

the
"public object module".

What is a "public object module" and how can I create one ???

Thanks a lot, Thorsten


Hi,

Just a note, but I seem to recall when I tried that aways back, that
the property does not save with the file (ie that data is lost when
you close the worksheet).

Not sure if that is an issue for you, or even if that is still the
case with later versions of excel, but you might want to check.

HTH,

Alan.