0

I want to restart the master userform for a project I'm working on excel. I tried hide, unload other userforms, call UserForm_Initialize and show again but not worked. Some variables still in memory, close (X) button didn't work anymore etc. I looked on internet and there is no solution . So i found that solution below.

I added another empty master userform and call my userform if user or my codes unload or close my userform, master userform automaticly show again. This works but i cant use vbModeless Because out of stack error i wonder is there another (more proper) solution ?

my master userform codes:

Option Explicit

Private Sub UserForm_Click()
    StartApp 'there is no escape :)
End Sub

Private Sub UserForm_Initialize()
    StartApp
End Sub
Public Sub StartApp()
    Me.Hide 'sometimes this form showing itself so i added everywhere :)
    Splash.Show
    Me.Hide
    StartApp
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    Cancel = True
    StartApp
End Sub

Splash is my loader form. Load's other forms etc.

Edit 1: Solved vbModeless problem with this link Still looking another (more proper) solution ? (Without master form)

  • Put a method in a regular module which you can call from the userform to close it and re-open it. – Tim Williams Jul 12 '22 at 20:42
  • I tried that. İ created close and start subs. Then Called close in userform close event and close calls start but not worked. Maybe i did it wrong can you show me an example – Mustafa VANLI Jul 12 '22 at 20:55

0 Answers0