ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   couple userform questions (https://www.excelbanter.com/excel-programming/370870-couple-userform-questions.html)

Gary Keramidas

couple userform questions
 
1) when the close(x) closes a form, does it create any kind of event to act on?

2) let's say you use a form as a main menu. clicking a command button loads a
submenu, so you either hide or unload the main menu.
the operation the 2nd command button launches takes x amount of time.
how can you load the main menu after the operation is completed?

--


Gary




[email protected]

couple userform questions
 
Hi Gary,

Perhaps you can use SaveSetting function ... like :

Dim r
Private Sub UserForm_Activate()
r = GetSetting("App", "Sect", "Ky")
If r = "" Then
r = 0
Exit Sub
Else
MsgBox "You've closed " & r & " times!"
End If
End Sub

Private Sub UserForm_Terminate()
SaveSetting "App", "Sect", "Ky", Val(r) + 1
End Sub

Rgds,

Halim




Gary Keramidas menuliskan:
1) when the close(x) closes a form, does it create any kind of event to act on?

2) let's say you use a form as a main menu. clicking a command button loads a
submenu, so you either hide or unload the main menu.
the operation the 2nd command button launches takes x amount of time.
how can you load the main menu after the operation is completed?

--


Gary



Harald Staff

couple userform questions
 
Bob explained the theory. I told you to try it and I guess you didn't. Many
people refuse to try a solution they don't immediately understand. That is
not a good approach. Most solutions to anything are complicated and
illogical, but they work anyway.

Best wishes Harald

"Harald Staff" skrev i melding
...
Hi Gary


Try the X on userform1.




Gary Keramidas

couple userform questions
 
harald:

i did try it. i know you know a lot more than i'll ever know. what i was looking
for was a simple, built in way. i thought there may be a method i didn't know
about. why isn't there a built in option, just like show, hide, activate? every
userform has an x,
figured if the x was clicked, the userform was closed and it could be acted on
without writing code
to do it.




--


Gary


"Harald Staff" wrote in message
...
Bob explained the theory. I told you to try it and I guess you didn't. Many
people refuse to try a solution they don't immediately understand. That is
not a good approach. Most solutions to anything are complicated and
illogical, but they work anyway.

Best wishes Harald

"Harald Staff" skrev i melding
...
Hi Gary


Try the X on userform1.








Bob Phillips

couple userform questions
 
Gary

The problem is that when the x is clicked, the form is unloaded, so there is
nothing to test against. Therefore you have to trap the close event, which
is what Query Close gives you.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
harald:

i did try it. i know you know a lot more than i'll ever know. what i was

looking
for was a simple, built in way. i thought there may be a method i didn't

know
about. why isn't there a built in option, just like show, hide, activate?

every
userform has an x,
figured if the x was clicked, the userform was closed and it could be

acted on
without writing code
to do it.




--


Gary


"Harald Staff" wrote in message
...
Bob explained the theory. I told you to try it and I guess you didn't.

Many
people refuse to try a solution they don't immediately understand. That

is
not a good approach. Most solutions to anything are complicated and
illogical, but they work anyway.

Best wishes Harald

"Harald Staff" skrev i melding
...
Hi Gary


Try the X on userform1.










Gary Keramidas

couple userform questions
 
thanks for the explanation. as i mentioned, i don't know near as much as you
guys do.

--


Gary


"Bob Phillips" wrote in message
...
Gary

The problem is that when the x is clicked, the form is unloaded, so there is
nothing to test against. Therefore you have to trap the close event, which
is what Query Close gives you.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
harald:

i did try it. i know you know a lot more than i'll ever know. what i was

looking
for was a simple, built in way. i thought there may be a method i didn't

know
about. why isn't there a built in option, just like show, hide, activate?

every
userform has an x,
figured if the x was clicked, the userform was closed and it could be

acted on
without writing code
to do it.




--


Gary


"Harald Staff" wrote in message
...
Bob explained the theory. I told you to try it and I guess you didn't.

Many
people refuse to try a solution they don't immediately understand. That

is
not a good approach. Most solutions to anything are complicated and
illogical, but they work anyway.

Best wishes Harald

"Harald Staff" skrev i melding
...
Hi Gary

Try the X on userform1.











Harald Staff

couple userform questions
 
Hi Gary

Glad it worked out in the end.
I wasn't trying to be smart or rude, I just believed my demo was simple and
to the point. Apologies if it wasn't so.

Best wishes Harald

"Gary Keramidas" <GKeramidasATmsn.com skrev i melding
...
thanks for the explanation. as i mentioned, i don't know near as much as

you
guys do.

--


Gary





All times are GMT +1. The time now is 10:14 PM.

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