Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7989647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:48:46+00:00 2026-06-04T12:48:46+00:00

In reference to vbScript opens up excel but doesn't load macro/modules? Now I tried

  • 0

In reference to vbScript opens up excel but doesn't load macro/modules?

Now I tried to run my vbscript from SQL Job. Though I get Job executed successfully, it didn’t open up my excel file(Checked Task Scheduler). I went to view the history for this job and found

Message
Executed as user: GSOPS4\SYSTEM. Microsoft (R) Windows Script Host Version 5.7 Copyright (C) Microsoft Corporation. All rights reserved.C:\WINDOWS\system32\TestTOPTMay307.vbs(5, 1) Microsoft Excel: Microsoft Excel cannot access the file ‘\gsops4\data_extracts\TestTOPTMay307.xlsm’. There are several possible reasons: The file name or path does not exist. The file is being used by another program. The workbook you are trying to save has the same name as a currently open workbook. Process Exit Code 0. The step succeeded.

I also followed the suggestions in this thread Run a C# Console Application from SQL Server Agent (Job)?

However I couldn’t get it to work. This thing has been annoying me for past 48 hours. Any clue to what’s causing it and how do I successfully execute my job( run my vbscript file from SQL) will be highly appreciated. Thanks all in adv!

Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:48:48+00:00Added an answer on June 4, 2026 at 12:48 pm

    An alternative view

    Excel is very good at popping up dialogs on the console and then hanging until they are actioned by a user. This is a very bad thing on a server, as it will freeze the process and leak running excel instances. It also requires you to have excel installed on the server itself.

    Generally you would be far better off scheduling a SSIS job via agent that reads the spreadsheet through an OLEDB driver and then replicating the calculation on a server-side job. What exactly does the macro do?

    I’ve done a few ETL jobs off Excel sources in my day and (IMO) the best way to deal with data off excel is to avoid having to invoke EXCEL.EXE at all costs. It is very finicky about dangling COM references, so you have to be very careful about disposing of all COM objects created. In some cases the default references (Worksheet, Workbook, Range etc.) create opaque references behind the scenes that you cannot actually tidy up programatically as the type library does not expose any facility to do so.

    The .NET primary interop assemblies add extra complications to this as they generate their own references that have to be explicitly tidied up as well. There is a significant impedance mismatch between COM and .Net – to the extent that several books have been written on making COM and .Net components play nicely together.

    Fortunately WSH doesn’t involve .Net, but COM remoting on Excel COM servers is not something I would recommend doing from within a DBMS.

    Two much safer approaches

    1. Open the workbook in the OLEDB driver – read the sheets into a staging table and then extract the data form there. This doesn’t even need Excel to be installed on the server, and is quite robust.

    2. Unravel the .xlsx zip file and get out the worksheets from that – this actually works better than you would think. The sheetxx.xml files are in a fairly straightforward format and the only other thing you are likely to need is sharedStrings.xml. Generally you shouldn’t need to do this with SQL Server if you have SSIS available, but it is quite a useful trick if you are working with (say) Oracle on a non-Windows host.

    EDIT:
    In order to use Excel through OLE automation you need to have Excel installed on the machine you’re running it on. Generally it’s not a great plan to have Excel installed on a server as it’s not particularly secure. It’s also a desktop tool and has a tendency to leak COM references and running Excel instances if you don’t dot your I’s and cross your T’s with your COM reference creation and disposal.

    SSIS has an excel data source. You can see it by creating a SSIS project in BIDS and creating a new connection manager. One of your options will be Excel.

    However, If you need to query a sharepoint list you’re better off querying it programatically without using Excel at all. A little google-fu should turn up some examples of how to do this, e.g. here.. You can do this through a standalone .Net app or through a script task in the SSIS package (script tasks are .Net custom tasks that you can build within a SSIS package).

    If you do this you’re probably better off developing it outside SSIS (use Visual C# Express if you don’t have any other option) and then porting it across to the script task. If you’re familiar with Python, IronPython or Boo are great tools for frigging with .Net APIs interactively to get something working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just discovered VBScript's GetRef function, which gets a reference to the function named
reference from: Merging Variable PHP I have problem with $_POST getting blank null after
With reference to the code from here With reference to the addListener(instance:Object, eventName:string, handler:Function)
I'm expecting to see a reference to VBscript Regular Expressions 5.5 by adding the
I know set in VBScript is used for assigning the object reference to the
i'm converting some vbscript from an asp app and ran across a line in
I have a problem in a VBScript that I am using with a VBA/Excel
For reference, the code is for the motorola 68008. Say I have code such
In reference to this answer to a Stack Overflow question : what is bench-testing
I reference the current page in a class with Page page = HttpContext.Current.CurrentHandler as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.