LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Global Variables

As in other languages, I guess it's considered good form to free
allocated variables.

I have a global variable of tyoe myObjectClasss, which I declare in the

module header like this:


Option Explicit
dim myObject as myObjectClass


I have made a sub updateMyObject which looks like this


Sub updateMyObject(a as integer)


If myObject = Nothing Then
set myObject = new myObjectClass
end if


myObject.initialize(a)


end Sub


I then have a lot of subs and functions that use myObject. It seems to
work fine.


However, Excel always crash when I shut it down. I am slightly worried
that it is because I never free myObject.


Would it be better if I set the variable in workbook_open and set it to

nothing in workbook_close?


Best Regards
Eric

 
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
global variables Mike Archer Excel Programming 4 May 3rd 06 07:33 PM
Global Variables mattsvai[_11_] Excel Programming 4 February 3rd 06 05:02 PM
Global Variables Francis Brown Excel Programming 9 November 27th 05 06:14 PM
global variables [email protected] Excel Programming 3 November 16th 05 11:44 PM
Global Variables Ernst Guckel[_4_] Excel Programming 2 May 7th 05 11:10 PM


All times are GMT +1. The time now is 02: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"