80010105 - Server Automation Error


  • Hi,

    We have a VB6 application which will open the excel sheet, format and print it. It is working fine in windows XP and windows 2000 server. But getting run-time when the same code is executed in Windows 2008 server(64-bit machine). Error message is, 


    Automation Error

    Server threw an Exception"

    Error throws when executing the below BOLDED code.

        'If Excel not already loaded, create a new instance of Excel
        If mobjExcelReport.MyExcelApp Is Nothing Then
            Set mobjExcelReport.MyExcelApp = CreateObject("Excel.Application")
        End If

        'Load Todays Excel doc
        Set mobjExcelReport.MyExcelWorkbook = mobjExcelReport.MyExcelApp.Workbooks.Open(sTargetPath & "\" & sTargetFileName, , , , "abcdef")

    Both the windows 2000 server and windows 2008 server has Excel8.0 library.

    Any idea on this error would help.

    Krishna Prakash
    13 ธันวาคม 2554 12:24


  • Errors starting with 0x8 are usually permission errors or memory pointers not pointer to a memory location you have permission to access.  Try opening the file manually using excel and see if the file will open with the same crediatials the program is using.  If the file opens then maybe the variable mobjExcelReport.MyExcelApp  is not valid.  I would then add a break point on the line that is giving the error by selecting the line with the mouse and pressing F9.  then add the variable mobjExcelReport to the watch window by highlighting the variable and right click the mouse selecting "Add Watch".  then check to see if both mobjExcelReport and mobjExcelReport.MyExcelApp are not NULL.
    13 ธันวาคม 2554 15:09
  • Hi Joel,

    Thanks for your detailed info.

    I tried the below things as per your comment.

    1) Tried opening the excel manually and it worked.

    2) Added a watch window for mobjExcelReport.MyExcelApp  and it shows as Excel object.

    I have attached the screen shots for your referance. But nothing helped.

    Krishna Prakash
    13 ธันวาคม 2554 15:48
  • Make sure you don't have two "\\" in the path name.  If not, I suspect the probelm is with the password.  Try running the same code without a password protected workbook and see if the problem stops happening.
    13 ธันวาคม 2554 20:24
  • Hi Joel,

    There is no \\ in the file path. I have checked with the excel file that doesn't have any password. Still the same issue.

    Krishna Prakash
    14 ธันวาคม 2554 5:00
  • Without seeing the entire code at this point of time I'm not sure I can help.  Two things to try are


    1) Make sure all the Excel.exe process are closed before you open you first workbook.  Sometimes the excel processes don't shutdown and there are a limit to the nuber of simulataneous excel.exe files that can ber opened at one time.  Check the Task Manager.

    2) Try making the excel application visible which may give a clue to where the problem is located.

    mobjExcelReport.MyExcelApp.visible = true

    • ทำเครื่องหมายเป็นคำตอบโดย Calvin_GaoModerator 4 มกราคม 2555 9:11
    • ยกเลิกการทำเครื่องหมายเป็นคำตอบโดย Krishna.133 4 มกราคม 2555 9:13
    14 ธันวาคม 2554 6:42
  • Still, iam facing the issue. I tried accessing the excel without passwords, made Visible Property = True. But still no luck.

    Failing with the same error message.

    Krishna Prakash
    4 มกราคม 2555 9:14