I found the problem...
I didn't have the close statement so I realy didn't see if there were any
exceptions thrown... And guess what - there were.
I got the "Old format or invalid type library. (Exception from HRESULT:
0x80028018 (TYPE_E_INVDATAREAD))" and had to set the culture to en-US.
For others needing the answer to this question, I changed the cultre info
like this:
System.Threading.Thread.CurrentThread.CurrentCulture = new
System.Globalization.CultureInfo("en-US");
Now the current workbook closes - and not the excel application.
"neoret" wrote:
> Yes, I've tried that. But then I quit every excel worksheet that is open...
>
> My addin allows the user to archive the worksheet in an external archiving
> system. The user may have many worksheets opened and I just want to close the
> one he has just archived. Therefore I need to close the worksheet instance -
> not the application.
>
>
> "Arvi Laanemets" wrote:
>
> > Hi
> >
> > Try this:
> > ....
> > excelAppl.Quit
> >
> >
> > --
> > Arvi Laanemets
> > ( My real mail address: arvi.laanemets<at>tarkon.ee )
> >
> >
> >
> > "neoret" <(E-Mail Removed)> wrote in message
> > news:1B294B54-429E-4629-AD25-(E-Mail Removed)...
> > >I have developed an addin using C#.
> > >
> > > I need to close the application from my addin. I tired using the close
> > > method like this:
> > >
> > > private Microsoft.Office.Interop.Excel.Application excelAppl = null;
> > > public Microsoft.Office.Interop.Excel.Workbook theActiveExcelWorkbook =
> > > null;
> > >
> > > excelAppl = (Microsoft.Office.Interop.Excel.Application)offApplObject;
> > > theActiveWorkbook = excelAppl.ActiveWorkbook;
> > >
> > > this.theActiveWorkbook.Close(false, false, missing);
> > >
> > > That does noe work. The code is called but nothing happens. No error
> > > message
> > > or nothing...
> > >
> > > Do you have some advice for me on how to make this work.
> >
> >
> >
|