Results 1 to 4 of 4

Thread: Excel Automation (null): The server threw an exception

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2010
    Posts
    2

    Excel Automation (null): The server threw an exception

    I'm attempting to run a simple VB script that opens an Excel 2007 spreadsheet, reads cell data and then echos it to the screen, however I get the following error:

    UpdateTitle.vbs(4, 1) (null): The server threw an exception

    Here is the code:
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = False

    objExcel.Workbooks.Open("C:\Temp\ADUserUpdates\ADUserUpdates\qryEmployee.xlsx")
    Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

    Wscript.echo objSheet.Cells(1,2)

    objExcel.ActiveWorkbook.Close
    objExcel.Application.Quit

    Script is being run on a WindowsXP SP3 machine in a corporate environment. If I run this same script on a machine with fresh install of Windows XP it runs fine but with the corporate image it does not. Domain GPOs have been eliminated, default local group policies have been restored and default security policies have been restored to corporate image but they have no effect. Not sure what else would be stopping this script from running. Any assistance would be greatly appreciated.

  2. #2
    Junior Member
    Join Date
    Jul 2010
    Posts
    27

    Re: Excel Automation (null): The server threw an exception

    uhm try this one?

    Set objExcel = CreateObject("Excel.Application")
    Set objWorkbook = objExcel.Workbooks.Open ("C:\Temp\ADUserUpdates\ADUserUpdates\qryEmployee.xlsx")


    intRow = 1
    Do Until objExcel.Cells(intRow,1).Value = ""
    a = objExcel.Cells(intRow, 1).Value
    b = objExcel.Cells(intRow, 3).Value
    c = c & " " & a & " " & b & vbCrLf
    intRow = intRow + 1
    loop
    objExcel.Application.Quit
    msgbox c
    Last edited by hajime; Sep 14th, 2010 at 03:28 AM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2010
    Posts
    2

    Re: Excel Automation (null): The server threw an exception

    Thanks for the response hajime! Unfortunately the code changes had no impact on the error. I still end up with the same error with the only difference being the line and character number:

    UpdateTitle.vbs(2, 1) (null): The server threw an exception.

    I've created scripts before that queried Excel without any problems but this issue started occurring as soon as we moved from Office 2003 to Office 2007. I thought this might be a security issue so I updated the Trusted Locations, of Excel's Trust Center settings, to include the path to the script but that had no effect either. Regardless, if I install a fresh copy of Windows XP and install Office 2007 I can get the script to work but if try to use the same script on a system that uses our Corporate image, it fails with the above error. So I'm just trying to narrow in on what changes were made to the corporate image that would have caused this error to occur. Any other ideas would be greatly appreciated!

  4. #4
    New Member
    Join Date
    Jan 2009
    Posts
    8

    Resolved Re: Excel Automation (null): The server threw an exception

    This may be an old thread, but I HATE unanswered questions when I am looking for them.

    I solved this same issue by running my prompt as an admin with full rights to both the folder and file (right-click on cmd and click "run as administrator").

    Found the solution here:
    http://www.daniweb.com/software-deve...w-an-exception

Posting Permissions

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



Click Here to Expand Forum to Full Width