LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Running an Excel Macro as a Scheduled Task

Hello all,

I'm trying to use the Windows Scheduled Tasks utility to run an .xls and a
certain macro within it. I've been able to run the .xls with no problem,
but not the macro. In Access, one can do it by adding /x macroname, but no
such luck with Excel, apparently.

I'd like to have the following macro, ExportAsHTMLAuto(), run through
Scheduled Tasks.

===

Sub ExportAsHTMLAuto()
dTime = Now + TimeValue("00:00:05")
Application.OnTime dTime, "ExportAsHTMLAuto"

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"T:\Dan Youngren\System\Engineering.htm" _
, FileFormat:=xlHtml, ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True
Application.OnTime Now + TimeValue("00:00:05"), "Save_Exit"

End Sub

Sub Save_Exit()
Application.Quit
ThisWorkbook.Close SaveChanges:=True
End Sub

===

So, 5 seconds after Excel opens, it should save as html, then close 5
seconds later.

How do I get this to be run as a Scheduled Task?

--
Message posted via http://www.officekb.com
 
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
After Windows update scheduled task uses wrong version of Excel CharlesW Excel Discussion (Misc queries) 0 July 15th 09 04:53 PM
Run Excel macro from Scheduled Task coolthinking Excel Worksheet Functions 4 July 13th 09 03:35 PM
Trying to run a MSQuery from Excel as a Scheduled Task Doug Excel Discussion (Misc queries) 1 March 6th 09 06:01 PM
Scheduled task hanging codemind Excel Programming 3 May 7th 04 03:03 PM
Scheduled Task Matt. Excel Programming 4 April 6th 04 03:07 PM


All times are GMT +1. The time now is 03:57 AM.

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

About Us

"It's about Microsoft Excel"