Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Uploading data from Excel - hitting "Enable Macros" prompt

Status
Not open for further replies.

adknbvi

Programmer
Apr 17, 2001
25
0
0
US
Hello,
I have an ASP.NET application that allows users to download their data into an Excel spreadsheet, then edit it and then upload it back into the Oracle database.

When uploading the data, we are copying the Excel file to the IIS server in a folder inside the virtual directory (this seems to be going fine) and then opening the file with Excel. At this point, the entire process hangs, because Excel is apparently waiting for us to answer the "Do you want to enable macros?" question. After awhile, the page times out and the EXCEL.EXE is left running (orphaned) on the web server.

I'm certain that this prompt can be answered programmatically, but I haven't found any information on it. Can anyone help? Is it related to Excel settings on the individual user's PC or would it be the settings on the server that are causing the issue?

Please let me know if I need to provide any more information.

Thanks!
 
and then opening the file with Excel
How and why are you opening the file once it has been uploaded?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Hi!

WHY OPEN THE FILE:
At this point in the process, the file exists on the server, but we need to open it in order to process the records within it. We have some validation/verification logic to carry out, then we store the updated records into the database.

In C#:

xl = new Excel.Application();
xl.Visible = false;
xl.ScreenUpdating = false;
xl.DisplayAlerts = false;

wb=xl.Workbooks.Open( strFileName , Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
sheet = (Worksheet)wb.ActiveSheet;
 
OK, I see two ways around this problem.

1) We can look into why it is failing and maybe impersonate another user.

2) Read the data another way (without creating an Excel object).

#2 is probably the easier option so lets see if this would be a solution for you:



____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top