View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
rci rci is offline
external usenet poster
 
Posts: 40
Default Re referencing an object

Hi all... a newbie question...

I would like to, in a function, create an object, then do things to it.

ex: Dim SpreadSheet1 As OWC10.Spreadsheet
Set SpreadSheet1 = CreateObject("OWC10.Spreadsheet")

and then play around with SpreadSheet1 as needed.

But what about when I re-enter the function? I don't want to create a new
object... I want to simply reference the object that was created earlier!


What is the proper programming methodology to handle this?

I could move the object creation outside of the function... but would it
then exist within the context of the function? How do I discover, from
within the fucntion, if the object already exists... and then to reference
it? Do I somehow pass the object, or some reference/pointer to the object
to the function is some way?

Thanks for helping a newbie...

MP