返回用户窗体页面的 VBA (EXCEL) 代码是什么?
What is the VBA (EXCEL) Code for backing to the userform page?
我正在编写一个 VBA 程序来从计算机读取工作簿:
Private Sub btnOpenWkbook_Click()
Dim strWkbookPath As String
strWkbookPath = Application.GetOpenFilename(filefilter:="Excel file, *.xlsx")
Workbooks.Open Filename:=strWkbookPath
Set Swkbook = Workbooks.Open(Filename:=strWkbookPath)
...
...
If strWkbookPath = "False" Then
Unload frmSalesReport
End If
end sub
点击 "open workbook" 然后打开对话框打开:
If the user clicks the Cancel button or Close button on the Open dialog box, how to back to the userform page?
现在我得到这个错误:
推荐看你的值strWkbookPath
。而且你会知道你应该做什么。
试试这个
Private Sub btnOpenWkbook_Click()
Dim strWkbookPath As String
strWkbookPath = Application.GetOpenFilename(filefilter:="Excel file, *.xlsx")
If strWkbookPath = "" Or strWkbookPath = "False" Then
Exit Sub
End If
Workbooks.Open Filename:=strWkbookPath
Set Swkbook = Workbooks.Open(Filename:=strWkbookPath)
'...
'...
'If strWkbookPath = "False" Then
' Unload frmSalesReport
'End If
End Sub
</pre>
我正在编写一个 VBA 程序来从计算机读取工作簿:
Private Sub btnOpenWkbook_Click()
Dim strWkbookPath As String
strWkbookPath = Application.GetOpenFilename(filefilter:="Excel file, *.xlsx")
Workbooks.Open Filename:=strWkbookPath
Set Swkbook = Workbooks.Open(Filename:=strWkbookPath)
...
...
If strWkbookPath = "False" Then
Unload frmSalesReport
End If
end sub
点击 "open workbook" 然后打开对话框打开:
If the user clicks the Cancel button or Close button on the Open dialog box, how to back to the userform page?
现在我得到这个错误:
推荐看你的值strWkbookPath
。而且你会知道你应该做什么。
试试这个
Private Sub btnOpenWkbook_Click()
Dim strWkbookPath As String
strWkbookPath = Application.GetOpenFilename(filefilter:="Excel file, *.xlsx")
If strWkbookPath = "" Or strWkbookPath = "False" Then
Exit Sub
End If
Workbooks.Open Filename:=strWkbookPath
Set Swkbook = Workbooks.Open(Filename:=strWkbookPath)
'...
'...
'If strWkbookPath = "False" Then
' Unload frmSalesReport
'End If
End Sub
</pre>