因此,此功能将有效地重新启动我的工作簿,但是,我设置为在打开工作簿时未打开用户窗体,并且不确定为什么。我不知道它是否绕过该功能或什么...
Private Sub CommandButton3_Click()
Dim sPath As String
Dim sName As String
sName = ThisWorkbook.Name
sPath = ThisWorkbook.Path
ThisWorkbook.Saved = True
Workbooks.Open Filename:=sPath & "\" & sName
''''at a minimum I need this userform to show and it wont when i run this funtion.
UserForm1.Show
End Sub
答案 0 :(得分:0)
您无法打开已经激活的文件。因此,您需要先关闭它才能再次打开它。它破坏了您的代码。这样就行不通了您需要关闭它。
如果要在开始时弹出用户窗体,只需将我的代码放入Workbook_Open,它将在每次启动文件时打开。
Private Sub CommandButton3_Click()
'Vbmodal ensures that user need to interact with userform or discard it to select cells etc.
UserForm1.Show vbmodal
End Sub