Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on IsEmpty() Function

Status
Not open for further replies.

JTBorton

Technical User
Jun 9, 2008
345
DE
I have a public variant type dynamic array that contains text descriptions of the possible settings that my forms and functions can pull from. The Workbook_Open() event calls a Friend sub that initializes and assignes values to the array when the work book opens. When I reset the project for debugging purposes, it of course resets all of my public variables. So in my user form, which requires the setting descriptions so it can place them in a combo box for the user to pick from, I placed the following statement in the UserForm_Initialize() event:

Code:
[COLOR=darkgreen]'Make sure public variables are intitialized. If the project has been reset they will have been lost[/color]
    [COLOR=darkblue]If[/color] IsEmpty(vntHistoryDescrip) [COLOR=darkblue]Then[/color]: [COLOR=darkblue]Call[/color] ThisWorkbook.InitializeVariables

My thinking was that when the form resets, and the variables along with it, they would contain an Empty value. So the IsEmpty function should return TRUE. However, it does not. So the question is, why does it return FALSE?

-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]
 
Have you tried this ?
If IsEmpty(vntHistoryDescrip(0)) Then Call ThisWorkbook.InitializeVariables

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Plus if the variables are Public (therefore outside the scope of the userform) and they are given values by a procedure (also outside the scope of the userform), then why do you think resetting the userform will reset the variables?

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top