P
poochi
Hi,
I have written an excel wrapper class in C#. Excel automation
components are used to read the excel file in my wrapper class. Now the
problem is, I get a dialog box with the following message in one of the
files that is being processed (when it is opened in Excel application
by double clicking on the file in windows explorer).
"Name conflicts with existing module, project, or object library"
ok. It tells me some VBA reference is wrong in the Excel file. But I
couldn't bypass this dialog programmatically. This wrapper class is
used in a non-interactive environment. Here is the sample code..
Excel.Application excelApplication = null;
Excel.Workbooks workBooks = null;
Excel.Workbook workBook = null;
string fileName = @"c:\temp\myexcelfile.xls";
object missingValue = Missing.Value;
try
{
excelApplication = new Excel.ApplicationClass();
// turn-off all interactive features
excelApplication.Visible = false;
excelApplication.Interactive = false;
excelApplication.DisplayAlerts = false;
excelApplication.DisplayInfoWindow = false;
excelApplication.ScreenUpdating = false;
excelApplication.AlertBeforeOverwriting = false;
excelApplication.AskToUpdateLinks = false;
// Open workbook
workBooks = excelApplication.Workbooks;
workBook = workBooks.Open(fileName, false, true, missingValue,
missingValue, missingValue,
missingValue, missingValue, missingValue, false, false,
missingValue, false, missingValue, true);
...........
...........
}
catch(Exception e)
{
System.Console.WriteLine(e.Message);
}
finally
{
.......
}
The application hangs at "Open" method and waiting for the dialog to be
closed. Is there anyway to turn off all the dialog boxes? As far as I
can see, I handled all the interactive properties in my code. But
still, the open method hangs.
Any help would be appriciated.
Thanks
I have written an excel wrapper class in C#. Excel automation
components are used to read the excel file in my wrapper class. Now the
problem is, I get a dialog box with the following message in one of the
files that is being processed (when it is opened in Excel application
by double clicking on the file in windows explorer).
"Name conflicts with existing module, project, or object library"
ok. It tells me some VBA reference is wrong in the Excel file. But I
couldn't bypass this dialog programmatically. This wrapper class is
used in a non-interactive environment. Here is the sample code..
Excel.Application excelApplication = null;
Excel.Workbooks workBooks = null;
Excel.Workbook workBook = null;
string fileName = @"c:\temp\myexcelfile.xls";
object missingValue = Missing.Value;
try
{
excelApplication = new Excel.ApplicationClass();
// turn-off all interactive features
excelApplication.Visible = false;
excelApplication.Interactive = false;
excelApplication.DisplayAlerts = false;
excelApplication.DisplayInfoWindow = false;
excelApplication.ScreenUpdating = false;
excelApplication.AlertBeforeOverwriting = false;
excelApplication.AskToUpdateLinks = false;
// Open workbook
workBooks = excelApplication.Workbooks;
workBook = workBooks.Open(fileName, false, true, missingValue,
missingValue, missingValue,
missingValue, missingValue, missingValue, false, false,
missingValue, false, missingValue, true);
...........
...........
}
catch(Exception e)
{
System.Console.WriteLine(e.Message);
}
finally
{
.......
}
The application hangs at "Open" method and waiting for the dialog to be
closed. Is there anyway to turn off all the dialog boxes? As far as I
can see, I handled all the interactive properties in my code. But
still, the open method hangs.
Any help would be appriciated.
Thanks