Closing userform VBA
Solved
gunbafo
Posted messages
55
Status
Member
-
gunbafo Posted messages 55 Status Member -
gunbafo Posted messages 55 Status Member -
Hello,
I don’t understand the behavior of a userform I just created.
Explanation:
I have a main Userform called "Menu" which includes several buttons, each with its own userform. When I close these userforms using the close button, they close and the "Menu" is displayed again. However, I recently added an additional button with a userform that closes and opens an Excel sheet linked to the macro of this new userform.
Why does it not behave like the others, i.e., close and display the Menu??
Thank you for your help.
Configuration: Windows XP / Internet Explorer 6.0
I don’t understand the behavior of a userform I just created.
Explanation:
I have a main Userform called "Menu" which includes several buttons, each with its own userform. When I close these userforms using the close button, they close and the "Menu" is displayed again. However, I recently added an additional button with a userform that closes and opens an Excel sheet linked to the macro of this new userform.
Why does it not behave like the others, i.e., close and display the Menu??
Thank you for your help.
Configuration: Windows XP / Internet Explorer 6.0
7 answers
The Move.. When the menu is open, it is shifted to the right and overflows the screen on the right.
Hence the need to set left and top to 0
For the UF, it's normal, if you debug you can see that when you close the UF, you close the menu and call the sheet.
To remedy this..
In Module1 add
Public Fermer as Boolean
In the UF Menu
In the UF Statistics add.
In the code of the button...
Another way to do it..simpler
Everything after the statistics button (UF Menu) should be put in the button code of the UF statistics
--
Experience teaches more surely than advice. (André Gide)
If you hit a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
NOTE: I do not respond to private messages for technical questions.
It should take place on the forum so that everyone can participate or benefit.
Hence the need to set left and top to 0
For the UF, it's normal, if you debug you can see that when you close the UF, you close the menu and call the sheet.
To remedy this..
In Module1 add
Public Fermer as Boolean
In the UF Menu
Private Sub Image22_Click() ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ' Statistics ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Statistics.Show If Fermer Then Exit Sub 'ADD Unload Menu
In the UF Statistics add.
Private Sub UserForm_Initialize() Fermer = True End Sub
In the code of the button...
Private Sub CommandButton1_Click() Fermer = False 'Test phase: check if a period is selected.'
Another way to do it..simpler
Everything after the statistics button (UF Menu) should be put in the button code of the UF statistics
--
Experience teaches more surely than advice. (André Gide)
If you hit a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
NOTE: I do not respond to private messages for technical questions.
It should take place on the forum so that everyone can participate or benefit.
Hello,
It's how they react to each other.
So that we understand, post your spreadsheet, possibly expunging sensitive data, on CiJoint.fr and put the link in a following post.
See you later
--
Experience teaches more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
NOTE: I do not respond to private messages for technical questions.
It must take place on the forum so that everyone can participate or benefit.
It's how they react to each other.
So that we understand, post your spreadsheet, possibly expunging sensitive data, on CiJoint.fr and put the link in a following post.
See you later
--
Experience teaches more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
NOTE: I do not respond to private messages for technical questions.
It must take place on the forum so that everyone can participate or benefit.
Re.
I can't see how these userforms can interact with each other... (please explain!)
Here is the file. I've done enough cleaning, and it is free of data.
For my problem, it's the "Statistics" button that needs to be clicked.
A userform opens but doesn't close with the cross.
Thank you for your help.
http://www.cijoint.fr/cjlink.php?file=cj201101/cijx0byqGX.xls
I can't see how these userforms can interact with each other... (please explain!)
Here is the file. I've done enough cleaning, and it is free of data.
For my problem, it's the "Statistics" button that needs to be clicked.
A userform opens but doesn't close with the cross.
Thank you for your help.
http://www.cijoint.fr/cjlink.php?file=cj201101/cijx0byqGX.xls
PS: It's for the same file for which I posted a question about writing style and you replied ( https://forums.commentcamarche.net/forum/affich-20659393-garder-style-d-ecriture-dans-macro#p20660670)
If you can address both problems at the same time
See you!
If you can address both problems at the same time
See you!
How do you expect me to examine your workbook if you put a password on the code????
And remove the .Show on the UF that opens in the ThisWorkBook.Open
Experience instructs more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that is empty. ;-)(Confucius)
NOTE: I do not respond to PMs for technical questions.
It has to happen on the forum so that everyone can participate or benefit from it.
And remove the .Show on the UF that opens in the ThisWorkBook.Open
Experience instructs more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that is empty. ;-)(Confucius)
NOTE: I do not respond to PMs for technical questions.
It has to happen on the forum so that everyone can participate or benefit from it.
Let's start with one problem at a time.
I didn't find your problem, please explain a bit more WHEN you find a malfunction and HOW (what sequence of actions)
Note.
In the initialize of Menu..replace
with..
Because the UF is shifted.
--
Experience teaches more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that is empty. ;-)(Confucius)
NOTE: I do not respond to private messages for technical questions.
It should take place on the forum so that everyone can participate or benefit.
I didn't find your problem, please explain a bit more WHEN you find a malfunction and HOW (what sequence of actions)
Note.
In the initialize of Menu..replace
Me.Width = Application.Width Me.Height = Application.Height
with..
Me.Move 0, 0, Application.Width, Application.Height
Because the UF is shifted.
--
Experience teaches more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that is empty. ;-)(Confucius)
NOTE: I do not respond to private messages for technical questions.
It should take place on the forum so that everyone can participate or benefit.
For my problem regarding this post:
I have a main Userform called "Menu"
My problem is that the Userform "Statistics" that opens from the "Menu" does not close as I wish. When you click the cross in the top right, it closes but opens the worksheet "statistics". I just want that when I close this userform with the cross, I return to the "Menu".
The Userform "New Missing" works this way. Why not the other one????
Can you find out the why and how with this?
Note: I have integrated your modification but I do not see what it changes??!!!
Some explanations would be welcome.
A+
I have a main Userform called "Menu"
My problem is that the Userform "Statistics" that opens from the "Menu" does not close as I wish. When you click the cross in the top right, it closes but opens the worksheet "statistics". I just want that when I close this userform with the cross, I return to the "Menu".
The Userform "New Missing" works this way. Why not the other one????
Can you find out the why and how with this?
Note: I have integrated your modification but I do not see what it changes??!!!
Some explanations would be welcome.
A+