SSIS script, excel automation and SQL agent problem
I have some vb.net script (Script task) which should do some manipulation with Excel file through excel automation. When I execute it through Visual Studio everything is OK, but If I put package inside SQLAgent job I get error:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file 'filename.exe'...at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)I thought that It is permision problem (I've created proxy inside SQL server so that job/package runs under same user as from Visual studio), but If i try to do some file manipulation inside script (for example copy file) I can normaly acces file. So it looks that here is problem with excel automation.Any hint/idea to solve my problem?Matej
January 15th, 2010 11:42am

Is MS Office installed in the server where you are running ur package?Hope this helps !! Sudeep| My Blog
Free Windows Admin Tool Kit Click here and download it now
January 15th, 2010 12:10pm

Yes. As I wrote, everything works fine If I run package from visual studio. I've also tried to execute package with dtexec through Task Scheduler and evenryting work fine. If I execute package through sql agent it doesn't work.As you see from error, exception is thrown from exel when I want to open file.
January 15th, 2010 12:19pm

Does your account executing the package have access to the file 'filename.exe'Hope this helps !! Sudeep| My Blog
Free Windows Admin Tool Kit Click here and download it now
January 15th, 2010 12:25pm

Yes it does. As I wrote, i've tried with diferent vb.net script to prove file access. I can for example copy file without any problem.
January 15th, 2010 12:43pm

I found solution:http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/b81a3c4e-62db-488b-af06-44421818ef91When I've created folderC:\Windows\System32\config\systemprofile\Desktopproblem gone :(Matej
Free Windows Admin Tool Kit Click here and download it now
January 15th, 2010 1:03pm

VIOLA !!! Thank you for all those who have contributed in helping me solve this issue, I chased it like a goose & finally got it working. Creating a .\SysProxy account on the target server solved the problem. Actually stopping all the other services such as SQL 2005 Agent service / SQL 2000 Agent Service , SQL 2005 Analysis Service / SQL 2000 Analysis service & all the other unwanted garbage services really helped, looks like it was locking the system in some wierd fashion. So the moral of the story is "Keep your house Clean & Tidy "... something to learn.. Every thing else was in place ( like Excel installed , 32 bit system etc. etc. running on the same server. ) I researched a lot to get it to this place, creating a desktop folder in systemprofile etc. etc... ~Mohan
January 7th, 2011 2:25pm

I have had the same problem for a while now. I tried adding C:\Windows\System32\config\systemprofile\Desktop the error went away but the file still does not open. the page does nothing and there is no errors. Can you please help. thanks
Free Windows Admin Tool Kit Click here and download it now
April 21st, 2011 10:36am

What is your machine in terms of software?Arthur My Blog
April 21st, 2011 10:58am

I have a server 2008 R2 and IIS 7 . I am developing a web app in asp.net and vb.net and just trying to open a simple excel file that exist on the server to run its macros on the back end and then write to a new excel file the result. To test just opening the excel file I am using the following code Dim ExcelApp, ExcelWB ExcelApp = CreateObject( "Excel.Application" ) ExcelApp.visible = True ExcelWB = ExcelApp.Workbooks.Open( "c:\book1.xlsx") this is triggered by a simple button on the page. I have also tried it this way Dim Excel_app As New Excel. ApplicationClass Dim strfilename As String strfilename = ResponseFile.PostedFile.FileName Excel_app.Visible = True Dim workbook As Excel.Workbook = Excel_app.Workbooks.Open(Filename:=strfilename, ReadOnly:=True ) either way I get the error that the excel file is not found. I have tried everything I have found online. I am out of ideas. Any thoughts?? thanks
Free Windows Admin Tool Kit Click here and download it now
April 21st, 2011 11:21am

Please tell us where is the relationship to SQL Server SSIS here? It is a different story in regard to developing a Web IIS based apps because those do not have such a broad access to a machine's local resources being a widely open applications by their nature.Arthur My Blog
April 21st, 2011 11:30am

There is no SQL here. I just found this link in relation to excel with people having the same error as I do with excel not opening and creating the desktop folder to solve it. I have seen this solution all over the internet for resolving this problem but it did not solve mine. My web application is to open an excel file on the server and let it run its macros then show the result on a second excel file. How do I givethe web app more access then ? anything more than IIS setups?? thanks
Free Windows Admin Tool Kit Click here and download it now
April 21st, 2011 11:46am

Then I would suggest you to make it a new post in the appropriate forum. In the meanwhile you may read this general article "Considerations for server-side Automation of Office": http://support.microsoft.com/kb/257757 Arthur My Blog
April 21st, 2011 11:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics