-1

I have code under workbook_open procedure. At the beginning of this code a userform (loading screen) initiates whilst the remainder of the code runs to hide/unhide sheets for the respective user.

The userform closes at the end of this code however, this means that it closes before addins have loaded.

Is there a way for me to code: Once addins have loaded, close userform?

I attempted the Wait function however this doesn't work, this just delays the userform closing and therefore delays the addins being loaded.

HarryY
  • 3
  • 2
  • How about having these processes in separate procedures/functions, so that VBA is forced to complete them before going to the next task? – Oran G. Utan Aug 09 '23 at 10:45

1 Answers1

0

Move your code currently in Workbook_Open to a separate "ContinueOpen" subroutine in a normal module. Then call this new routine from Workbook_Open, using Application.OnTime:

Private Sub Workbook_Open()
    Application.OnTime Now, "'" & ThisWorkbook.FullName & "'!ContinueOpen"
End Sub
jkpieterse
  • 2,727
  • 1
  • 9
  • 18