Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default How to label an object that persists in memory?

Hi there

In order to keep an object in memory with a know reference point, I
typically store it in an element of a public array. Thus, the element
number it is stored in becomes a reference point to the object and
using this number I can access that specific object's methods through
other UDFs.

The problem with this though is that it is not particularly neat in
that referencing an object in memory via a number offers no
description to what the object is. I would much rather be able to
attach a (user-defined) label to the object and use that label as a
reference point. However, my problem then becomes how to set a
pointer from that label to the array element the object is stored in.

Does anybody have any ideas that I might try to achieve this labelling
process?

Thanks very much
Lloyd

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How to label an object that persists in memory?

I would be more inclined to use a collection as opposed to an array...

Public colObjects As Collection

Sub PopulateCollection()
Set colObjects = New Collection

colObjects.Add Sheet1, "MySheet"
colObjects.Add Range("A1:B2"), "MyRange"

MsgBox colObjects("MySheet").Name
MsgBox colObjects("MyRange").Address
End Sub
--
HTH...

Jim Thomlinson


"pinkfloydfan" wrote:

Hi there

In order to keep an object in memory with a know reference point, I
typically store it in an element of a public array. Thus, the element
number it is stored in becomes a reference point to the object and
using this number I can access that specific object's methods through
other UDFs.

The problem with this though is that it is not particularly neat in
that referencing an object in memory via a number offers no
description to what the object is. I would much rather be able to
attach a (user-defined) label to the object and use that label as a
reference point. However, my problem then becomes how to set a
pointer from that label to the array element the object is stored in.

Does anybody have any ideas that I might try to achieve this labelling
process?

Thanks very much
Lloyd


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default How to label an object that persists in memory?

It's not very clear what you are doing or trying to do, but have you
considered a user-defined type? You could include a description as one
of its elements. You can also declare an array of this type.

Hth,
Merjet


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default How to label an object that persists in memory?

Gotcha,

So you can store the object in a collection and then attach a label to
it to describe it by...

That might work although I will have to re-write my UDFs to access the
various methods via the collection first, but that seems ok.

Cheers
Lloyd

Reply
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
2 Label Options - Forms Object vs Control Box Object Awrex Excel Discussion (Misc queries) 3 July 17th 09 07:10 PM
Passing a Label object to another procedure derobin Excel Programming 1 August 16th 06 10:43 AM
How to create a Delete method which frees memory occupied by my object lexcel Excel Programming 2 July 3rd 06 12:08 AM
Remove object from memory lexcel Excel Programming 8 July 2nd 06 03:16 AM
macro warning persists even after deleting all macros Todd Excel Discussion (Misc queries) 3 July 25th 05 10:12 PM


All times are GMT +1. The time now is 03:57 PM.

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

About Us

"It's about Microsoft Excel"