I
ina
Hello guys,
I would like to schedule a macros
So first of all I would like to open an external program from excel
calling PLauch, once the program open I would like to execute my macro
"operations" and once the macro finished I would like to save it
somewhere. But I am not very convinient with Application.Ontime and
schedule macro.
This is my code
Public Sub Workbook_Open()
On Error GoTo ErrHand
Dim dtmTime As Date
Dim dtmSave As Date
OpenPLaunch ' I launch the program
dtmTime = Now + TimeValue("00:00:15")
Application.OnTime dtmTime, "operations"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:\test\test.xls", FileFormat:=xlHtml, ReadOnlyRecommended:=False,
CreateBackup:=False
'Application.DisplayAlerts = True
'dtmSave = dtmTime + TimeValue("00:01:00") 'I would like to have
the exact time after macro is finished
'Application.OnTime dtmSave, "Save_Exit"
ErrHand:
MsgBox "error"
End Sub
Sub operations()
Sheet1.Activate
Sheet1.GetInfo
Sheet2.Activate
Sheet2.AllClients
End Sub
Sub Save_Exit()
Application.Quit
ThisWorkbook.Close SaveChanges:=True
End Sub
Could someone help me with this issue?
Thanks ina
I would like to schedule a macros
So first of all I would like to open an external program from excel
calling PLauch, once the program open I would like to execute my macro
"operations" and once the macro finished I would like to save it
somewhere. But I am not very convinient with Application.Ontime and
schedule macro.
This is my code
Public Sub Workbook_Open()
On Error GoTo ErrHand
Dim dtmTime As Date
Dim dtmSave As Date
OpenPLaunch ' I launch the program
dtmTime = Now + TimeValue("00:00:15")
Application.OnTime dtmTime, "operations"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"C:\test\test.xls", FileFormat:=xlHtml, ReadOnlyRecommended:=False,
CreateBackup:=False
'Application.DisplayAlerts = True
'dtmSave = dtmTime + TimeValue("00:01:00") 'I would like to have
the exact time after macro is finished
'Application.OnTime dtmSave, "Save_Exit"
ErrHand:
MsgBox "error"
End Sub
Sub operations()
Sheet1.Activate
Sheet1.GetInfo
Sheet2.Activate
Sheet2.AllClients
End Sub
Sub Save_Exit()
Application.Quit
ThisWorkbook.Close SaveChanges:=True
End Sub
Could someone help me with this issue?
Thanks ina