ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User Defined Object help fast (https://www.excelbanter.com/excel-programming/335660-user-defined-object-help-fast.html)

reddog9069[_14_]

User Defined Object help fast
 

I have a template that users use to create a few different worksheets
from. I have an object, that I want to be available throughout the
life of the worksheet. Then each time the worksheet opens, it will
create a new object that is there until the user closes the worksheet.

The problem appears to be that when the new worksheet gets created, and
is saved, the object that was created while still in the template gets
reset so it is no longer instanciated.

I have a module that defines the object in the global area: Public
oMSR As clsMSR

Then in a sub routine in the module: Set oMSR = New clsMSR

Am I right in thinking that the object is reset after it is saved as a
new name?
I have tried resetting it after the document is saved, but I still
cannot get the object to be instanciated.

I always get a Run-Time Error '91': Object variable or With Block
variable not set.

How should I reference the variable throughout all my modules?

just oMSR.whatevermethod or
moduletheglobalvariableisdefined.oMSR.method

Thanks


--
reddog9069
------------------------------------------------------------------------
reddog9069's Profile: http://www.excelforum.com/member.php...o&userid=24458
View this thread: http://www.excelforum.com/showthread...hreadid=390575



All times are GMT +1. The time now is 06:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com