Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Closing a userform from a different module.
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00541806
Message ID:
00541838
Vues:
20
>I have a macro that opens another excel file from a userform, the excel file that opens has an auto_open macro. When the auto_open macro runs I want to unload the useform from the other module. Does anybody know how I can pull this off? I don't think I have found the right unload statment. Thanks Jason

Hi Jason,

Here is what I found in VBA help file:

Unload Statement Example
The following example assumes two UserForms in a program. In UserForm1's Initialize event, UserForm2 is loaded and shown. When the user clicks UserForm2, it is unloaded and UserForm1 appears. When UserForm1 is clicked, it is unloaded in turn.

' This is the Initialize event procedure for UserForm1
Private Sub UserForm_Initialize()
Load UserForm2
UserForm2.Show
End Sub
' This is the Click event for UserForm2
Private Sub UserForm_Click()
Unload UserForm2
End Sub

' This is the Click event for UserForm1
Private Sub UserForm_Click()
Unload UserForm1
End Sub

You can also try to hide UserForm just before opening another Excel file.

UserForm1.Hide

HTH
Igor Gelin
Database Developer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform