Method '~' of object '~' failed in vb6 with Excel - excel

We are facing a issue with one of our VB 6.0 application.
There is line of code which convert a text file to excel file through Excel.Workbook.
This code works fine when we run through windows application.
But if we run the same exe from a windows service developed in C#.Net then it gives this error on this line
oWB.SaveAs FileName, XlFileFormat.xlExcel8
I have tried to search on google but didn't get any success.
Any suggestion will be very much helpful.
Thanks in Advance.
Regards
AR

While not an answer to your specific question, you might consider:
Considerations for server-side Automation of Office
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
The bold text is bold in the article.
Basically you aren't supposed to even attempt what you are doing.

Related

Using inropservices.powerpoint in windows service

I have a windows service which activates Interop powerpoint Application class.
It works fine using console but when I try to run it as a windows service on my server (Windows Server 2012) it throws COMException when i use app.open method
When I run the windows service on my pc it also works fine
NOTE: I've installed Microsoft Office 2013 on my server, and added a Desktop folder in C:\Windows\System32\config\systemprofile and in SystemWOW64
Exception details: System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component
Thanks in advance
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.
As a workaround you may consider using the Open XML SDK, see Welcome to the Open XML SDK 2.5 for Office for more information.

Error deploying VS 2015 application on server

I am using VS 2015 to create a console application that has a reference to Microsoft.Office.Interop.Excel. When I deploy it on a server (Windows Server 2012) I get the following error:
Retrieving the COM class factory for component with CLSID {0004567-3456-
0000-C002-000434000046} failed due to the following error: 80040154
I read some old postings that suggest I must have Office 2010 installed on the server. However, this is not possible. Is there any way to embed Excel assemblies in my application?
Or is there any different approach to resolve this issue? What I need to do is just extract an Excel file sheet names as a list....
Please remember that you need to have the host application installed on the target machine. When and where do you run the console application on the server?
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.
You may consider using the Open XML SDK if you deal with open XML documents only. See Welcome to the Open XML SDK 2.5 for Office for more information. Or use any third-party components designed for the server-side execution.

What is office runtime? Where is it useful?

I have a .net solution for converting word/excel to pdf developed in MS Visual Studio .Net 2003.I added references i.e., Microsoft.Office.Interop.Excel, Microsoft.Office.Interop.Word in my project. It is working fine in my local system where MS Office is installed but when I tried to execute in the server where MS Office is not installed, I face some Class ID errors 00024500-0000-0000-c000-000000000046 and 000209FF-0000-0000-c000-000000000046 with respect to Word and excel. So i told my client to install MS Office on server but he wants me to use Office runtime 2010 to convert MS office documents? So what is office runtime actually? Was it helpful in my case? Does MS Office installation is required if I am using VSTO?
I am new here. Kindly help.
Thanks,
Praveen.
There is no "Office runtime".
I added references i.e., Microsoft.Office.Interop.Excel, Microsoft.Office.Interop.Word in my project.
Interop assemblies are used to marshal your calls into unmanaged environment. There is no actual COM servers installed that may handle your calls (i.e. no endpoints).
Anyway, Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. You can read more about that in the Considerations for server-side Automation of Office article.
If you deal only with open XML documents you can use the Open XML SDK. See Welcome to the Open XML SDK 2.5 for Office for more information.
But if you need to deal with binary file formats you have to look for third-party components that are designed for the server-side execution.

Installing Microsoft Office on a windows server?

I could not google a straight simple answer to this, so i'm trying my luck here.
is there a problem installing Microsoft office 2007\2010\2013 on a network windows-based server, to be able to do some server-side conversions and simple automatic operations using its inter ops libraries on user generated documents?
If it is, is there anything i need to know prior to installing it ? any licenses needed ? cost of these ? is it the same as installing office on a client pc ?
Thanks in advance.
Microsoft Office supports Windows Server OS - feel free to install it on your server. But it doesn't support automation on the Server server side. The Considerations for server-side Automation of Office page states the following:
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.
Developers can use Automation in Microsoft Office to build custom solutions that use the capabilities and the features that are built into the Office product. Although such programmatic development can be implemented on a client system with relative ease, a number of complications can occur if Automation takes place from server-side code such as Microsoft Active Server Pages (ASP), ASP.NET, DCOM, or a Windows NT service.

Use Microsoft Office 2013 interop dll in sharepoint 2010

Is it possible to use interop dll from Office 2013 in Sharepoint 2010 solutions? I need to use excel in my Sharepoint solution, but on server was installed Office 2013 and i cant chose Microsoft.Office.Interop.Excel.
Thanks a lot
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.
You can read more about that in the Considerations for server-side Automation of Office article.
Consider using Open XML SDK or any other third-party components instead.

Resources