vba错误:对象变量或未设置块变量
我不知道刚刚发生了什么!请帮忙。这是我的代码!
If intMsgBox = vbYes Then
Unload frmNewOrder // error here
Unload Main_Menu //error here
ActiveSheet.PrintPreview
wkbNewOrder.Worksheets("New Order").Select
wkbNewOrder.Worksheets("New Order").Delete
wkbNewOrder.Worksheets("Main Menu").Select
End If
答案 0 :(得分:4)
答案 1 :(得分:0)
看起来您将frmNewOrder声明为变量,但您没有设置它,您的代码如下所示:
Dim MyForm As UserForm1
Unload MyForm
但它应该是:
Dim MyForm As UserForm
Set MyForm = UserForm1
Unload MyForm