ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CommandButton State (https://www.excelbanter.com/excel-programming/376893-commandbutton-state.html)

Mats Samson

CommandButton State
 
I have a Userform where some Commandbuttons are made Visible=False during the
process. But when I want to preview my underlying document I have to Hide the
Userform. After closing the Preview and returning to the Userform, the
CommandButtons becomes visible again.
Is there any neat way to check the state of the buttons before the preview
and return to that state when the Userform is displayed again? I can of
course go through button by button and set a variable and go through it again
and reset to initial state when redisplaying the Userform, but it seems to be
a dull and sluggish solution.


Bob Phillips

CommandButton State
 
They should be hidden when shown later.

Are you sure you hide it and show it, not Unload and Load?

--
HTH

Bob Phillips

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

"Mats Samson" wrote in message
...
I have a Userform where some Commandbuttons are made Visible=False during

the
process. But when I want to preview my underlying document I have to Hide

the
Userform. After closing the Preview and returning to the Userform, the
CommandButtons becomes visible again.
Is there any neat way to check the state of the buttons before the preview
and return to that state when the Userform is displayed again? I can of
course go through button by button and set a variable and go through it

again
and reset to initial state when redisplaying the Userform, but it seems to

be
a dull and sluggish solution.




Mats Samson

CommandButton State
 
No Bob, it's only Hidden but I think I found the fault.
The Visible=False instruction was issued in another and Private procedure
and most probably it didn't retain the values when the Userform was hidden
and shown again.
It works though doing other stuff like changing page in the multipage form
and back again.
Thanks anyway

"Bob Phillips" wrote:

They should be hidden when shown later.

Are you sure you hide it and show it, not Unload and Load?

--
HTH

Bob Phillips

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

"Mats Samson" wrote in message
...
I have a Userform where some Commandbuttons are made Visible=False during

the
process. But when I want to preview my underlying document I have to Hide

the
Userform. After closing the Preview and returning to the Userform, the
CommandButtons becomes visible again.
Is there any neat way to check the state of the buttons before the preview
and return to that state when the Userform is displayed again? I can of
course go through button by button and set a variable and go through it

again
and reset to initial state when redisplaying the Userform, but it seems to

be
a dull and sluggish solution.






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

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