time of day automation

R

Robert McMahon

I am trying to write a VBA code to run a certain module
application at a certain time. If someone could point me
in the write direction I can figure the rest out.
Basically I am going to open a certain xls file on
startup and that xls file will contain the VBA
programming to do everything else. This is what I have
but it will not work.

Sub a()
Application.OnTime TimeValue("12:00"), "Test"
End Sub
Sub Test()


Workbooks.Open "C:\Documents and Settings\Robert
McMahon\My Documents\Macro Program for Reports.xls"
End Sub
 
B

Bob Phillips

Robert,

Exactly what do you mean by it will not work? The OnTime method looks okay.

If it's not running on startup is the problem, pout the OnTime method in a
macro called Auto_Open, or in the ThisWorkBook Workbook_Open event.
 
S

shockley

Your macro worked for me at 12 noon but not at 12 midnight (I recreated your
folder and file names). You might eliminate one possible source of error by
using a more specific time format like "12:00PM".

HTH,
Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top