+ Reply to Thread
Results 1 to 1 of 1

Code Execution Hangs When Run by the Task Scheduler

  1. #1
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,919

    Code Execution Hangs When Run by the Task Scheduler

    I am troubleshooting this macro as part of a larger issue.

    I run a task on the Windows Task Scheduler. It opens an Excel workbook script. The script has an on open event that opens a target Excel workbook, and executes a macro in that workbook.

    This system works for my other files with the exception of one file that “hangs” and will not complete execution.

    If the script is kicked off by the task scheduler and I am not logged in, the task fails.

    If the script is kicked off by the task scheduler and I am logged in, the task fails.

    If the script is kicked off by me running the task scheduler manually, it runs successfully.

    If the script is kicked off by the task scheduler and I am logged in but unchecked the box that says “Run whether the user is logged in or not,” it runs successfully.

    Have I forgotten any combination?

    Since the task scheduler works for other scripts (all of which use the same code) and target workbooks, I suspect the problem is with this workbook and not the task scheduler.

    I created a macro, AppendToLog, that writes a time stamp and a string to a text log. I placed a number of these statements in the code so I can track its execution.

    Attached is a copy of the log for last night’s run. Also shown below is the code that is running. The line on which the code stopped executing is highlighted in red. This failure point “moves around” slightly as I add or delete code above it. It seems like the code executes a fixed number of lines of code and then stops. Is this possible?

    My apologies for not including the workbook, but there is simply too much proprietary data to replace with desensitized data.

    I am also going to cross-post this to the Microsoft Community.

    FYI: Windows 7 Professional, Office 2016. I’ve only started seeing this issue since upgrading to 2016. The same script and target work just fine on my laptop Windows 7 Professional, Office 2013. And yes, I did an offline repair on office 2016.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Task List Scheduler
    By excelhelpseeker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-12-2017, 12:16 PM
  2. Help with Task scheduler to run a Macro
    By Lycn in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2015, 03:29 PM
  3. Program execution hangs on deleting rows shown in an AutoFilter
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-22-2013, 10:12 PM
  4. Running Excel from task scheduler. Scheduler doesn't end
    By tony h in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-31-2013, 09:49 PM
  5. Excel 2007 : disable task scheduler
    By ilkamalo in forum Excel General
    Replies: 0
    Last Post: 10-08-2010, 03:37 PM
  6. Windows Task Scheduler Question
    By tekman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2008, 05:00 PM
  7. [SOLVED] task scheduler
    By Big Jim in forum Excel - New Users/Basics
    Replies: 0
    Last Post: 06-01-2006, 02:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1