Hi experts,
I have a problem with a report. I would export the content from 4 tables in 1 Excel File with 4 Sheets.
With the standard functions include in Excel Buffer (370) it don't work because there don't have a "AddSheet" function.
So now I would try it with Automation. I use Dynamics NAV 2009 and Excel 2010.
My Report would use the Microsoft Excel 14.0 Object Library. I write a litte piece of code if the connection between NAV and Excel works:
CREATE(XlApp,TRUE,TRUE);
IF NOT CREATE(XlApp,TRUE,TRUE) THEN BEGIN
ERROR(Text000);
END ELSE BEGIN
ERROR(Text001);
END;
I get this Error Message:
Could not create an instance of the OLE control or Automation server identified by [..]
Check that the OLE control or Automation server is correctly installed and registred.
I find some help by Dr. Google and mibuso but nothing works. I installed the VB6.0-KB290887-X86.exe --> don't work.
I registered the NShandler.dll (or somethink like this) --> don't work.
And now, I need your help to solve it.
Thanks for any suggestions.
EDIT: It's strange, if I check the standard Excel Buffer functions like "CreateBook" it's work. In Globals it's show me as a Unknown Automation server and the ID ist for the Excel 8.0 Library. Why this works? Strange...
EDIT 2: I forgot to say, with our license I can't create a new function in the Excel Buffer table. This was my first idea.
EDIT 3: Oh my god, i used the "Microsoft Excel 14.0 Object Library"._Application instead of the *.Application without underscore. And now i don't get thsi error message above, but my IF Clause say: Excel don't found.
EDIT 4: Okay, now it works. With this code in the "On Post Data Item" Trigger:
IF ISCLEAR(XlApp) THEN
CREATE(XlApp);
IF NOT CREATE(XlApp,TRUE,TRUE) THEN BEGIN
ExcelBuffer.CreateBook();
ExcelBuffer.CreateSheet(TABLECAPTION,TABLECAPTION,COMPANYNAME,USERID);
END;