ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unload A Form based on a Variable in my Module (https://www.excelbanter.com/excel-programming/388612-unload-form-based-variable-my-module.html)

[email protected]

Unload A Form based on a Variable in my Module
 
How do I unload a hidden Userform when a condition in my module
becomes true?
Say, when AllDone = 1?

I'm new to this, please forgive if this is a dumb question.


Jim Thomlinson

Unload A Form based on a Variable in my Module
 
Something has to change the value of AllDone at some point in the module. You
have to test the value at each point where the value changes.

if AllDone = 1 then Unload(Userform1)

A variable changing state does not generate an event.

--
HTH...

Jim Thomlinson


" wrote:

How do I unload a hidden Userform when a condition in my module
becomes true?
Say, when AllDone = 1?

I'm new to this, please forgive if this is a dumb question.



[email protected]

Unload A Form based on a Variable in my Module
 
Yeah, I tried that first! I get:
Run-time error '361': Can't Load or Unload this Object

I'm using an older excel, 97, is there a different syntax?


On May 2, 1:39 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Something has to change the value of AllDone at some point in the module. You
have to test the value at each point where the value changes.

if AllDone = 1 then Unload(Userform1)

A variable changing state does not generate an event.

--
HTH...

Jim Thomlinson



" wrote:
How do I unload a hidden Userform when a condition in my module
becomes true?
Say, when AllDone = 1?


I'm new to this, please forgive if this is a dumb question.- Hide quoted text -


- Show quoted text -




Peter T

Unload A Form based on a Variable in my Module
 
Try Jim's suggestion again but without the brackets
if AllDone = 1 then Unload Userform1

Although there are differences between XL97 and successive versions, there's
nothing in particular relating to what you appear to be doing.

Regards,
Peter T

wrote in message
oups.com...
Yeah, I tried that first! I get:
Run-time error '361': Can't Load or Unload this Object

I'm using an older excel, 97, is there a different syntax?


On May 2, 1:39 pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com wrote:
Something has to change the value of AllDone at some point in the

module. You
have to test the value at each point where the value changes.

if AllDone = 1 then Unload(Userform1)

A variable changing state does not generate an event.

--
HTH...

Jim Thomlinson



" wrote:
How do I unload a hidden Userform when a condition in my module
becomes true?
Say, when AllDone = 1?


I'm new to this, please forgive if this is a dumb question.- Hide

quoted text -

- Show quoted text -






[email protected]

Unload A Form based on a Variable in my Module
 
Fiddling around some more, I found the unload command works if I omit
the parentheses. Thank you for setting me down the right path...I had
been wondering if I needed some particular code in the userform or
something. Once I knew that Unload should work, I could focus my
debug efforts!





All times are GMT +1. The time now is 05:41 AM.

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