Windows task scheduler unable to open or add workbook after CreateObject("Excel.Application") is pass

Anonymous
2024-04-22T03:06:09+00:00

Hi Support team,

I have .exe from VB.NET job which able to run by double from a network drive. But this .exe job able to run in a windows task scheduler only a production environment server. The job get error when run in a task scheduler on a backup server.

Windows Server 2019, Office 2016 the same program .exe job on both server

The task scheduler able to create a text log file. But unable to open, add a workbook and get this error.

22/04/2024 09:29:32 CreateObject("Excel.Application") is pass.

22/04/2024 09:29:32 unable to add a workbook to objExcel. Microsoft Excel cannot open or save any more documents because there is not enough available memory or disk space.

• To make more memory available, close workbooks or programs you no longer need.

• To free disk space, delete files you no longer need from the disk you are saving to.

22/04/2024 09:29:32 unable to assigh a cell value in a sheet. Object reference not set to an instance of an object.

22/04/2024 09:29:32 Fail to save as Test_output.xlsx. Object reference not set to an instance of an object.

I've set both :

  1. group policy "log on as batch" adding a user account to run
  2. create "Desktop" folder under systemprofile in under System32 and SysWOW64 as able to find from the internet.

this link has issue nearly the same but the solution is unable for my case.

https://answers.microsoft.com/en-us/insider/forum/all/cannot-run-taskmanager-gettting-error-windows/c6458b0f-aaf3-461b-84bb-cb1da275dde9

Need your suggestion,

Kittisak

Windows for business | Windows Server | User experience | Remote desktop services and terminal services

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} vote

4 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Anonymous
    2024-04-22T18:46:04+00:00

    Hello,

    The error message you’re seeing is often related to Excel’s ability to manage its resources.

    First, ensure that the user account running the task scheduler has the necessary permissions to access Excel and to read/write files where necessary. Excel needs to be able to access the user's profile on the system. You can try running the task scheduler with a different user account.

    Additionally, ensure that DCOM settings for Excel are correctly configured on the backup server. Run dcomcnfg.exe, navigate to "Component Services" -> "Computers" -> "My Computer" -> "DCOM Config" and find "Microsoft Excel Application". Ensure the security and identity settings here match those of the production environment.

    You can also try repairing or reinstalling the Office 2016 application on the server.

    I hope this helps.

    Best regards

    0 comments No comments
  3. Anonymous
    2024-04-23T08:24:52+00:00

    Hi Jacen,

    Thank you for your quick response. Here are summary for my issue.

    environment: There are production and backup servers which has Windows server 2019, and MS Office 2016, Windows task scheduler in a "General" tab set a configure for Windows 7. The job is run by a service user account.

    .exe working: The .exe job does functions Create Excel.Application, add a workbook, assign a worksheet, fills an Excel cell value, then save as to the D:..... folder or the network format \<server name>...., then open another Excel template from the network style path.

    Problem: The .exe job able to run by double click. But by the task scheduler, only on the production server able to right click and run successfully without any error. But on the backup server, right click exit from the try .. catch with messages in my initial question.

    By the task scheduler only on the backup, after create Excel.Application, it can't save the file, can't open an exist template file. But it can write a log text file whatever in D:.... or a network style. I also change the network path to the folder that not in AutoSys auto replicate the whole folder from the production to backup.

    already setting: on both production and backup server,

    1. grant access permission to a service user account to:

    C:\Windows\System32\config\systemprofile\Desktop

    C:\Windows\SysWOW64\config\systemprofile\Desktop

    1. Compare DCOM Config in "Security" and "Identity" tabs of two servers to the same setting. "Identity" doesn't specify to any user..
    2. gpedit.msc -> Computer Config -> Windows Settings -> Security Settings -> Local Policies -> User Rights assignment -> "log in as a batch job" adding a service account which is used to run.
    3. "C:\Users&lt;user account" folder: compare from both servers

    Suspect: what is a real user that is used to run Excel.Application. Because the error message is about unable to access the path. What is the working space for a new add workbook. Because it can't add a new workbook.

    Regards,

    Kittisak

    0 comments No comments
  4. Anonymous
    2024-05-07T00:37:26+00:00

    Hello MS expertise,

    Could you help to limit the root cause? Any security policies in GPEDIT or which Excel.Application requires permission. Because the production server able to run properly but the backup site server. The user account to run the task job is the same user account name. And I'm not the a person who set up the servers.

    Thank you in advance,

    Kittisak

    0 comments No comments