Y
Yi
We have a VB.NET application that automates Excel (XP). This application runs
well under Windows XP. But when running on a Windows Server 2003, the
application would fail with an exception if no Excel instance is running. It
would work if the Excel is open before running it. Our code looks like:
-------------------------------------------------------------------
dim excelApp As Excel.Application
Try
excelApp = GetObject(Nothing, "Excel.Application")
If (excelApp Is Nothing) Then
excelApp = CreateObject("Excel.Application")
End If
Catch
End Try
myWorkbook = excelApp.Workbooks.Add
-------------------------------------------------------------------
It seems that the last line throws exception if Excel is not open before
running this code. I notice that after this application failure, there is
Excel process still running. And if in this case run our application again,
it would succeed. Is there any restrictions with Excel automation on a server
edition of Windows? Thanks in advance.
well under Windows XP. But when running on a Windows Server 2003, the
application would fail with an exception if no Excel instance is running. It
would work if the Excel is open before running it. Our code looks like:
-------------------------------------------------------------------
dim excelApp As Excel.Application
Try
excelApp = GetObject(Nothing, "Excel.Application")
If (excelApp Is Nothing) Then
excelApp = CreateObject("Excel.Application")
End If
Catch
End Try
myWorkbook = excelApp.Workbooks.Add
-------------------------------------------------------------------
It seems that the last line throws exception if Excel is not open before
running this code. I notice that after this application failure, there is
Excel process still running. And if in this case run our application again,
it would succeed. Is there any restrictions with Excel automation on a server
edition of Windows? Thanks in advance.