Hi Everyone please help with my problem.
I have these codes that automatically run at specified time stated in the macro,
But I would like to run it with time preferred by the user without editing the
time inside the program
Eg: I would like to run it for 10 minutes only. Upon opening the workbook
the inputbox will appear for user to set time. Thanks in advance!!!
Sub Workbook_BeforeClose(Cancel As Boolean)
'
Application.OnTime dTime, "ian", , False
End Sub
Sub Workbook_Open()
Application.OnTime Now + TimeValue("01:00:30"), "close"
End Sub
Public dTime As Date
Sub close()
dTime = Now + TimeValue("01:00:30")
Application.OnTime dTime, "close"
Windows("CLOSE.xls").Activate
ActiveWindow.Close False
End Sub
I have these codes that automatically run at specified time stated in the macro,
But I would like to run it with time preferred by the user without editing the
time inside the program
Eg: I would like to run it for 10 minutes only. Upon opening the workbook
the inputbox will appear for user to set time. Thanks in advance!!!
Sub Workbook_BeforeClose(Cancel As Boolean)
'
Application.OnTime dTime, "ian", , False
End Sub
Sub Workbook_Open()
Application.OnTime Now + TimeValue("01:00:30"), "close"
End Sub
Public dTime As Date
Sub close()
dTime = Now + TimeValue("01:00:30")
Application.OnTime dTime, "close"
Windows("CLOSE.xls").Activate
ActiveWindow.Close False
End Sub