PDA

View Full Version : sceduled task



gibbo1715
08-21-2005, 11:06 AM
I just read a very good solution to running a macro automatically by paleo here http://vbaexpress.com/forum/showthread.php?t=2328






VBA:
strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set objNewJob = objWMIService.Get("Win32_ScheduledJob")errJobCreated = objNewJob.Create _ ("Excel.exe", "********040000.000000-420", _ True , 1 Or 4 Or 16, , , JobID) Wscript.Echo errJobCreated

VBA tags courtesy of www.thecodenet.com (http://www.thecodenet.com/)



This script will run excel every monday, wednesday and friday at 04:00, then you can set at workbook_open to do what you want and close the file.


My question is where do i put the vba file to make this work

Sorry if im being a bit foolish but I didnt quite get it

cheers

Gibbo