My question is: is it possible to run time-macros even if the excel is closed? i would like the PC start the vba-macros even if the excel is down. is it possible?
thanx in anticipation
t.hansen
My question is: is it possible to run time-macros even if the excel is closed? i would like the PC start the vba-macros even if the excel is down. is it possible?
thanx in anticipation
t.hansen
Not sure if this is exactly what you are looking for, but what I do is use an auto_open macro in the workbook I want to run automatically each day. Then I use Windows Task Scheduler to open the workbook at 6am every morning. This will open a new instance of Excel, though, so if you have Excel already open, you could get error messages when Excel tries to re-open files in your XLStart folder. The way I handle this is that I save and close all open workbooks to temporary files and close Excel every day as follows:
This is in my in Personal.xls ThisWorkbook:
Private Sub Workbook_Open()
'Application.OnTime TimeValue("5:00"), "My_Close"
End Sub
This is in a standard module within Personal.xls:
Sub My_Close()
Dim wb As Workbook
Dim i As Integer
i = 1
Application.DisplayAlerts = False
For Each wb In Workbooks
If Left(wb.Name, 6) = "orders" Then
wb.Close savechanges:=False
End If
wb.SaveAs Filename:="c:\TossOrKeep" & i & ".xls"
i = i + 1
Next
Application.Quit
Set wb = GetObject("C:\Documents and Settings\Myname\Application Data\Microsoft\Excel\XLSTART\PERSONAL.XLS")
Set wb = Nothing
End Sub
I can't see how an Excel macro can run if the Workbook is closed. You will need something to open the Workbook and then let the macro run - probably VB or similar
Don’t have an account yet? Register yourself now and be a part of our community!