Sub endTheScript()
Dim AckTime As Integer, InfoBox As Object
Set InfoBox = CreateObject("WScript.Shell")
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close (0)
objExcel.Quit
AckTime = 5
Select Case InfoBox.Popup("Click OK (Message closes automatically after " & AckTime & " seconds).", _
AckTime, "This is your Message Box", 0)
Case 1, -1
Exit Sub
End Select
WScript.Quit
End Sub
I have to insert this Sub in my all code?Not used to this form. maybe the following will work
VBA Code:Sub endTheScript() Dim AckTime As Integer, InfoBox As Object Set InfoBox = CreateObject("WScript.Shell") objExcel.ActiveWorkbook.Save objExcel.ActiveWorkbook.Close (0) objExcel.Quit AckTime = 5 Select Case InfoBox.Popup("Click OK (Message closes automatically after " & AckTime & " seconds).", _ AckTime, "This is your Message Box", 0) Case 1, -1 Exit Sub End Select WScript.Quit End Sub
I replaced and saw , its not even open the Excel file now.It replaces the sub with that name as that is the one that is stopping the closure
Sub endTheScript()
Dim AckTime As Integer
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close (0)
objExcel.Quit
AckTime = 5
Select Case objShell.Popup("Click OK (Message closes automatically after " & AckTime & " seconds).", _
AckTime, "This is your Message Box", 0)
Case 1, -1
Exit Sub
End Select
WScript.Quit
End Sub