I have written a Macro that a Form button runs, and it works fine the first time. But the button is still "pressed", and when I press the button again (re-run the Macro), it fails on th error "Object Variable or With block variable not set". I think I am not finishing the macro correctly.
Thanks,
Pete
The top of the code is
On Error GoTo Err_NSS_Dashboard_Click
Dim xl As Excel.Application
Set xl = New Excel.Application
xl.Visible = True
xl.Workbooks.Add
.
.
.
and the bottom is
.
.
.
Set xl = Nothing
rst.Close
Exit_NSS_Dashboard_Click:
Exit Sub
Err_NSS_Dashboard_Click:
MsgBox Err.Description
Resume Exit_NSS_Dashboard_Click
End Sub
Thanks,
Pete
The top of the code is
On Error GoTo Err_NSS_Dashboard_Click
Dim xl As Excel.Application
Set xl = New Excel.Application
xl.Visible = True
xl.Workbooks.Add
.
.
.
and the bottom is
.
.
.
Set xl = Nothing
rst.Close
Exit_NSS_Dashboard_Click:
Exit Sub
Err_NSS_Dashboard_Click:
MsgBox Err.Description
Resume Exit_NSS_Dashboard_Click
End Sub