Other Issues - VBScript Excel Scheduled Task

Asked By Chris Wieman
03-Nov-08 11:08 AM

I have a Scheduled Task (a CMD file with 2 lines of code (cscript script1.vbs and cscript script2.vbs) running on a W2000 server with MS Office 2003.  Both scripts open Excel, execute a query, and format the returned data in a pivot table.  If I run the script from the Command prompt, it runs successfully without error.  The scheduled task opens Excel, but then does nothing.  Excel can be seen in the Task Manager and exits only after the scheduled task timeout (Currently 2 hours).

I can include the script if you need it.

Which user...  Which user...

03-Nov-08 03:22 PM
Are you using the same user to run the script in both cases?  You might want to check file permissions and the such if you've selected a user to run the task under other than the the one you tested in the cmd prompt.  That's pretty much all I can think of- that's pretty strange.  Hope you get it figured out!

Regards,
-Charles

Other issues refered by Lalji Mer  Other issues refered by Lalji Mer

04-Nov-08 10:07 AM

The first reference does not apply, as I don't have a function in Excel trying to run.  The script does all of the work.  And I don't understand how the 2nd reference applies to me at all. 

-chris

Other issues - Which User  Other issues - Which User

04-Nov-08 10:08 AM

In both cases (via schedule and locally) I'm running it as Network Admin.

Thanks,

-chris

vbscript excel schedule task  vbscript excel schedule task
04-Nov-08 10:34 AM
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


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.

I hope this helps!

source from :
http://www.vbaexpress.com/forum/archive/index.php/t-2328.html
also try this
http://www.codeproject.com/KB/shell/ScheduledTaskWizard.aspx
Things that caused me issues - maybe some help  Things that caused me issues - maybe some help
17-Nov-08 03:18 PM

Hi Chris,

I had a similar problem to you and found a solution eventually.  The best way to test for problems is to watch the task run while you're logged in as the same user.  Using this method I was able to find out that 2 things in particular weren't helping

Macro Security - I've had to set this to 'low' (in Excel under Tools, Macros, Security) so that the 'Enable Macros/Disable Macros' prompt doesn't appear when Excel opens a macro workbook.  This is far from ideal, so I'm now looking into digitally signing the macros.

AutoRecover - This has had to be completely shut down (in Excel under Tools, Options), as it was halting macro execution by forcing the 'user' to make a decision on what to do with potentially recovered workbooks from another session.  There appear to be two settings for this - one referring to a specific workbook, and the other to do with the actual installation of Excel for that particular user - that's how I've interpreted it anyway.  Both are in Tools, Options.

Unfortunately since last week the same problem has returned where Excel appears to open and then do nothing.  I've stripped a test right back down to a macro which literally quits Excel as soon as it runs, and even that isn't currently working.  I suspect a recent Windows update and believe the problem is either user permissions or something new in Excel - unfortunately that doesn't narrow it down very much.

Good luck,

Peter.

Other Issues - Excel via Scheduled task  Other Issues - Excel via Scheduled task
17-Nov-08 03:26 PM

Peter,

Thank you for the hints.  But it works interactively, so Macro security and AutoRecover do not seem to be a part of the problem/solution.  And worse, it functions perfectly under XP.  So I have it running on my laptop, which is not ideal, as I have to leave it running.

Thank you,

-chris

Create New Account
help
solution to this would be appreciated. Thanks in advance! Word Application Errors Discussions Windows Server 2003 (1) Windows 2003 Server (1) Office System (1) Word 2003 (1) Outlook (1) Word (1) GubbenH (1) HiI´m (1) Hi Josh, What version of example, should not be a shared template) and what are the settings in Word (if 2003 or earlier) in Tools = > Options = > File locations? = = = = = = = = = = = Hello, I am troubleshooting this behavior as part towards a permenant solution to this would be appreciated. Thanks in advance! > > - - Bob Buckland ?:-) MS Office System Products MVP *Courtesy is not expensive and can pay big dividends* Bob, Thanks for your reply. This is Word 2003 and it's running on Windows Server 2003 SP2. Why everybody logs into the terminal server using RDP, I'm not entirely sure
Word won't save Office Word won't save via and method: save, save as, or by closing the document and downloaded security update WindowsXP-KB908531-v2-x86-ENU as suggested but the problem persists. Office Miscellaneous Discussions Adobe (1) MVP (1) XP (1) MS (1) Excel (1) HKEY_CURRENT_USER (1) PDF I've declined to save the document) which I have consistantly declined. I tried uninstalling Office XP Pro and reinstalling it- -> no effect. I tried the update that was suggested- -> no including conflicting add-ins and some Word settings. In Tools = > Options = > Save turn off the 'Autorecover' option then close Word. From Start = > Run search for all files using ~$*.*;*.tmp and recycle a pop-up: "Saving the Autorecovery file is postponed for document 1". << - - Bob Buckland ?:-) MS Office System Products MVP *Courtesy is not expensive and can pay big dividends* It worked! I to resolve it with the suggestions. ANy other ideas I could try? > > - - Bob Buckland ?:-) MS Office System Products MVP *Courtesy is not expensive and can pay big dividends* Bob Buckland ?:- \ );2745239 www.herbtyson.com Bob Buckland ?:- \ );2745239 Wrote: I'm having the same problems with Word 2003, SP3 installed. Tried the suggestion above with no results. Any other ideas? I can't all. The Save As-window never pops up. The problem only occurs in MS Word (Office 2003 Sp3). No other programs are affected, not even the other Office applications. . . To clarify
MS OFFICE 2003 WORD nagging issue Windows Server I have been trying to solve this issue for 6 months but no success so far. I have MS office Small business edition Open License installed on my Terminal Server. Everytime, user open MS Word It tries trying to recover a document that it thinks was last save with AutoRecover on September, 14 2006. It show the document in the left Pane - - Recoverd and Origianl is opening with a lost document. After several month struggling with this issue, I installed OFFICE 2007 SBE. I don't have this issue with OFFICE 2007. I have un-installed MS office 2003 SBE many times , deleted all the office folders, and reinstall it many times. but this
MS OFFICE 2003 nagging issue Office I have been trying to solve this issue for 6 months but no success so far. I have MS office Small business edition Open License installed on my Terminal Server. Everytime, user open MS Word It tries trying to recover a document that it thinks was last save with AutoRecover on September, 14 2006. It show the document in the left Pane - - Recoverd and Origianl is opening with a lost document. After several month struggling with this issue, I installed OFFICE 2007 SBE. I don't have this issue with OFFICE 2007. I have un-installed MS office 2003 SBE many times , deleted all the office folders, and reinstall it many times. but
Reinstalling Windows 7 Office I have win 7 running . . . well, crawling. . . on a new quad core computer (it really started its slow-down after installing Office 2007). Its so sluggish that I have decided to do a fresh reinstall. Drive C tired of being told some features will be lost when saving as an Excel 97-2003 file when those features all CAME from Excel 2000. The only reason I upgraded from Office 2000 was because it just did not seem comfortable with Win 7 (blurred type and s). My son has had Win 7 on a laptop for over a year with Office 2003 running and he loves it. Never a moments problem! Office Miscellaneous Discussions Office 2007 (1) Office 2003 (1) Windows 7 (1) Vista (1) Excel (1) Float (1) Disk