NAV 2009 Excel Automation
iansilvers
Member Posts: 38
I hope someone can help.
I am performing an upgrade from NAV 4.02 to NAV 2009 SP1. I have a codeunit that was used to create an Excel spreadsheet using automation variables for the Excel Application, Workbook, and Sheet. I have taken the object from 4.02 and imported into 2009, and it will not compile failing with the error
"The variable XLWOOKBOOK::SHEETPIVOTTABLEBEF is defined more than once"
I have tried copying the variables from codeunit 424 and pasting into my codeunit, but still get the same error! Even copying them into an empty codeunit gives the problem
Anyone got any ideas what is happening?
I am performing an upgrade from NAV 4.02 to NAV 2009 SP1. I have a codeunit that was used to create an Excel spreadsheet using automation variables for the Excel Application, Workbook, and Sheet. I have taken the object from 4.02 and imported into 2009, and it will not compile failing with the error
"The variable XLWOOKBOOK::SHEETPIVOTTABLEBEF is defined more than once"
I have tried copying the variables from codeunit 424 and pasting into my codeunit, but still get the same error! Even copying them into an empty codeunit gives the problem
Anyone got any ideas what is happening?
0
Comments
-
Move your variable from global to local or vice versa. I also encountered the problem and this fixed it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks for the suggestion but it is not that easy to move from Global to Local, as the variables are widely used throughout the codeunit. This does not explain why the problem does not exist in codeunit 424 which I can compile without errors!0
-
Then try shorten the variable name. See also this thread: Strange error when trying to create global word automationNo support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
Thanks for the reply. I copied the variables from codeunit 424 which compiles correctly, but I still get the same error. So, following on from the suggestion in the Word automation topic, I have exported my codeunit as text, removed all the event handles for the automation variables and re-imported - problem gone.
Surely by having the WithEvents set to No, it should not have created the events in the first place?0 -
Pardon for bumping the old topic, but I found this while searching for help with the same issue, but not by the key terms i was looking for. My post is just adding a few keywords to the helpful thread.
When compiling Table 370 Excel Buffer, it would not compile with this as the error:
Microsoft Dynamics NAV Classic
The variable XLAPP::PROTECTEDVIEWWINDOWBEFO is defined more than once.
An example could be: 'File' exists as both a data type and a global variable.
OK
Saving it uncompiled, exporting as text, deleting all the events that SHOULDN'T EVEN BE THERE (I had WithEvents to No on all of them, so annoying that it does this), and reimporting, then compiling.
Thanks all for the help.JEREMY VYSKA
CEO, Spare Brained Ideas, Göteborg, Sweden
New (April 2021) Getting Started with Microsoft Dynamics 365 Business Central Book Available: "Your First 20 Hours with Business Central"0 -
I found a solution to this problem.
If you log into any different non-64 bit machine, save and compile it, the report carries you around the xlapp automation error.
d.0 -
Non-64 bit? Man, next we'll have to use a MS-DOS 6.22 compiler...

Good to know that works too.JEREMY VYSKA
CEO, Spare Brained Ideas, Göteborg, Sweden
New (April 2021) Getting Started with Microsoft Dynamics 365 Business Central Book Available: "Your First 20 Hours with Business Central"0 -
Pretty sure this is an issue in the NAV 2009 client:
https://mbs.microsoft.com/knowledgebase/KBDisplay.aspx?scid=kb;EN-US;22567560 -
Well, I'm not sure if it is exclusive to the 2009 client; same thing for me (64 bit and have Nav 5).0
-
Yes that's correct, it's not exclusive to 2009 (check the linked KB, mentions 5 also), but the OP is using 2009 so that's where it's relevant
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
