Excel.Application=true cambia a false
Publicado por Javier (1 intervención) el 15/12/2008 13:42:12
Hola a a todos tengo el codigo siguiente :
private Excel.Application app = null;
private Excel.Workbook workbook = null;
private Excel.Worksheet worksheet = null;
private Excel.Range workSheet_range = null;
private void CreateExcel1()
{
try
{
if (app != null)
{
app.Quit();
NAR(app);
NAR(workbook);
}
app = new Excel.Application();
workbook = app.Workbooks.Add(1);
worksheet = (Excel.Worksheet)workbook.Sheets[1];
app.IgnoreRemoteRequests = true;
app.Visible = true;
}
catch (Exception e)
{
throw new Exception("Error creacion Excel" + e.Message.ToString());
}
}
private void NAR(object o)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(o);
}
catch { }
finally
{
o = null;
}
}
Cuando intento hacer visible el Excel este automaticamente se pone a false, se me abre una ejecucion excel en el task manager , pero que no lanza nunca el excel. Necesito ayuda he probado a mirar las referencias de mis dll y todo esta aparentemente correcto, no me lanza ninguna excepction utilizo M Objet Library 11 Gracias por las respuestas.. y demas sugerncias
private Excel.Application app = null;
private Excel.Workbook workbook = null;
private Excel.Worksheet worksheet = null;
private Excel.Range workSheet_range = null;
private void CreateExcel1()
{
try
{
if (app != null)
{
app.Quit();
NAR(app);
NAR(workbook);
}
app = new Excel.Application();
workbook = app.Workbooks.Add(1);
worksheet = (Excel.Worksheet)workbook.Sheets[1];
app.IgnoreRemoteRequests = true;
app.Visible = true;
}
catch (Exception e)
{
throw new Exception("Error creacion Excel" + e.Message.ToString());
}
}
private void NAR(object o)
{
try
{
System.Runtime.InteropServices.Marshal.ReleaseComObject(o);
}
catch { }
finally
{
o = null;
}
}
Cuando intento hacer visible el Excel este automaticamente se pone a false, se me abre una ejecucion excel en el task manager , pero que no lanza nunca el excel. Necesito ayuda he probado a mirar las referencias de mis dll y todo esta aparentemente correcto, no me lanza ninguna excepction utilizo M Objet Library 11 Gracias por las respuestas.. y demas sugerncias
Valora esta pregunta


0