Excel 2007 Pivot Table Conflict
navinse
Member Posts: 4
Hey,
I have been trying to make a simple pivot table from Navision 4.0 SP2 to Excel 2007. I have used CU 424 as reference, other posts and created a macro in Excel. Everything seems to be working correctly until I try to call my pivot cache automation variable. It states that the variable needs to be instantiated. I read on some forums regarding owc 12 that there might be a conflict with the new owc and pivot table creation. Is this true or does my code look bad?
The variable is of type Automation and subtype of 'Microsoft Excel 12.0 Object Library'.PivotCache. Here is the code segment that it breaks on:
TempExcelBuffer.CreateBook;
TempExcelBuffer.CreateNewSheet('ILE DATA','1',CompanyInformation.Name,USERID,2);
TempExcelBuffer.CreateNewSheet('ILE PIVOT','2',CompanyInformation.Name,USERID,1);
xlPivotCache := xlApp.ActiveWorkbook.PivotCaches.Add(1,('ILE PIVOT!A1:C4'));
xlPivotCache.CreatePivotTable('','PivotTable1');
TempExcelBuffer.GiveUserControl;
I appreciate any help that you give and let me know if I am unclear.
I have been trying to make a simple pivot table from Navision 4.0 SP2 to Excel 2007. I have used CU 424 as reference, other posts and created a macro in Excel. Everything seems to be working correctly until I try to call my pivot cache automation variable. It states that the variable needs to be instantiated. I read on some forums regarding owc 12 that there might be a conflict with the new owc and pivot table creation. Is this true or does my code look bad?
The variable is of type Automation and subtype of 'Microsoft Excel 12.0 Object Library'.PivotCache. Here is the code segment that it breaks on:
TempExcelBuffer.CreateBook;
TempExcelBuffer.CreateNewSheet('ILE DATA','1',CompanyInformation.Name,USERID,2);
TempExcelBuffer.CreateNewSheet('ILE PIVOT','2',CompanyInformation.Name,USERID,1);
xlPivotCache := xlApp.ActiveWorkbook.PivotCaches.Add(1,('ILE PIVOT!A1:C4'));
xlPivotCache.CreatePivotTable('','PivotTable1');
TempExcelBuffer.GiveUserControl;
I appreciate any help that you give and let me know if I am unclear.
0
Comments
-
somewhere in your code you need to say
if not exists(xlPivotCache) then create(xlPivotCache) ;
You need to issue a create command on automation variables before working with them.0 -
Thanks for the reply.
I tried the suggestion but it had an error that there cannot be a assignment of text to automation. So I just put in a CREATE(xlPivotTable) and it came back with an error of:
Could not create an instance of the OLE control Automation Server identified by GUID:(long string of characters):'Microsoft Excel 12.0 Object Library'.PivotCache.
Check that the OLE control or Automation server is correctly installed.
Any ideas? I appreciate the help. ](*,)0 -
in my post above, I wrote if not exists
it should have said:if isclear(xlPivotCache) then create (xlPivotCache) ... end of your code ... Clear(xlpivotcache)
Your error could be because you are using a class that isn't defined in the automation variable.
automation is not correctly installed.0 -
Stlll no luck. I put in your code segment and it still gave the error about not being able to create an instance of the OLE control in Automation server. Sorry, but just a novice on the automation instances. How can you tell that you have the automation server/instance installed properly? Thanks for the help in advance.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions