I'm trying to disable a button when it is clicked:
Private Sub submitButton_Click()
Me.submitButton.Enabled = False
If dataPath = "" Or skuPath = "" Then
MsgBox "Please ent开发者_StackOverflower spreadsheet locations."
Else
Call importExcelData(dataPath, "data")
Call importExcelData(skuPath, "skus")
If validate = True Then
Call generateReports
End If
End If
End Sub
I'm getting a runtime error: "You can't disable a control while it has the focus". Do you know a way around this?
Thanks!
You must first set the focus to a different control.
That said, if you really have no other control to send the focus to (which I'd find hard to believe), there is a "workaround." You can add a command button and set its TabStop property to False and its Transparent property to True and set the focus to that control.
精彩评论