Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Use Scheuled Tasks to fire Event Code

I did a little searching and didn't find much on this one. Can I use
Scheduled Tasks to run a snippet of code, which is a private sub, behind a
sheet? If so? How is it done?

Thanks,
Ryan--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Use Scheuled Tasks to fire Event Code

I've used Scheduled Tasks to open a workbook and run the code in the
"ThisWOrkbook" module as Workbook_Open. You may have to self sign the code
so that it opens without the "Enable Macros" prompt.
--
HTH,

Barb Reinhardt



"ryguy7272" wrote:

I did a little searching and didn't find much on this one. Can I use
Scheduled Tasks to run a snippet of code, which is a private sub, behind a
sheet? If so? How is it done?

Thanks,
Ryan--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default Use Scheuled Tasks to fire Event Code

I created a .vbs file to autorun one workbook, and set up a scheduled task to
run my vbs every morning at 9am. Here is the contents of the vbs file:

strUserIn = MsgBox("Run the PO file?",vbYesNo,"Automated Prompt")
If strUserIn = 6 then
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Documents and
Settings\MyUserID\Desktop\PO analysis\opv.xls")
objExcel.Visible = True
objExcel.Run "CrunchIt", "SkipEmailPrompt"
objExcel.ActiveWorkbook.Save
'objExcel.ActiveWorkbook.Close(0)
'objExcel.Quit
end if

CrunchIt is my main macro, and "SkipEmailPrompt" is an optional parameter
because when I am running this daily I don't want to be prompted as to
whether or not to generate automated emails to my user group, I only want to
do that if I am running that macro manually.

Note that when I do it this way, I do not get a macro warning prompt, the
vbs just opens the workbook and the macro starts running (well, only if I
answer yes to the prompt, but you could take that out if you needed to).

I commented out the close/quit lines because I like to look at the updated
graphs each time it runs, but your needs might be different.

HTH,
Keith


"ryguy7272" wrote:

I did a little searching and didn't find much on this one. Can I use
Scheduled Tasks to run a snippet of code, which is a private sub, behind a
sheet? If so? How is it done?

Thanks,
Ryan--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MouseUp Event Does Not Fire TC[_10_] Excel Programming 2 April 6th 08 02:36 AM
event fire Curt Excel Programming 19 March 7th 07 12:29 AM
Can't get Sheet_Change event to fire - please help [email protected] Excel Programming 4 November 30th 06 04:28 AM
Event doesn't fire Frank Xia Excel Discussion (Misc queries) 6 February 11th 06 12:54 AM
Workbook Open event does not fire Robots Excel Programming 2 December 3rd 04 11:26 PM


All times are GMT +1. The time now is 02:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"