英文:
Run code once add-ins have finished loading
问题
我在workbook_open过程中有一段代码。
在这段代码的开头,一个用户窗体(加载屏幕)启动,同时代码的其余部分运行以隐藏/显示适用于各个用户的工作表。
用户窗体在代码结束时关闭,然而,这意味着它在加载插件之前关闭。
是否有一种方法可以编写代码:
一旦插件加载完毕,就关闭用户窗体?
我尝试了Wait函数,但这并不起作用,它只是延迟了用户窗体的关闭,因此也延迟了插件的加载。
英文:
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.
答案1
得分: 0
将当前位于Workbook_Open中的代码移动到一个普通模块中的单独的"ContinueOpen"子例程中。然后从Workbook_Open中调用这个新例程,使用Application.OnTime:
Private Sub Workbook_Open()
Application.OnTime Now, "'" & ThisWorkbook.FullName & "'!ContinueOpen"
End Sub
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论