Error. Export template excel to NAS in NAV 2013R2
snupy
Member Posts: 11
Hi Everyone,
Can you please!
What am I doing wrong?
ExcelBuf.OpenBook_NAS2(FileName); - GOOD
Error in the function ExcelBuf.OpenSheet_NAS2("Template Sheet Name");
OpenSheet_NAS2(SheetName : Text[30])
i := 1;
EndOfLoop := XlWrkBkRTC.Worksheets.Count;
ERROR
A call to System.__ComObject.get_Count failed with this message: The type of one or more arguments does not match the method's parameter type.
WHILE (i <= EndOfLoop) AND (NOT Found) DO BEGIN
XlWrkShtRTC := XlWrkBkRTC.Worksheets.Item(i);
ERROR
A call to System.__ComObject.get_Item failed with this message: The type of one or more arguments does not match the method's parameter type.
IF SheetName = XlWrkShtRTC.Name THEN
Found := TRUE;
i := i + 1;
END;
IF Found THEN
XlWrkShtRTC := XlWrkBkRTC.Worksheets.Item(SheetName)
ELSE
ErrorExcelProcessing(STRSUBSTNO(WorksheetNotFoundErr,SheetName));
Help me, please!!!
Can you please!
What am I doing wrong?
ExcelBuf.OpenBook_NAS2(FileName); - GOOD
Error in the function ExcelBuf.OpenSheet_NAS2("Template Sheet Name");
OpenSheet_NAS2(SheetName : Text[30])
i := 1;
EndOfLoop := XlWrkBkRTC.Worksheets.Count;
ERROR
A call to System.__ComObject.get_Count failed with this message: The type of one or more arguments does not match the method's parameter type.
WHILE (i <= EndOfLoop) AND (NOT Found) DO BEGIN
XlWrkShtRTC := XlWrkBkRTC.Worksheets.Item(i);
ERROR
A call to System.__ComObject.get_Item failed with this message: The type of one or more arguments does not match the method's parameter type.
IF SheetName = XlWrkShtRTC.Name THEN
Found := TRUE;
i := i + 1;
END;
IF Found THEN
XlWrkShtRTC := XlWrkBkRTC.Worksheets.Item(SheetName)
ELSE
ErrorExcelProcessing(STRSUBSTNO(WorksheetNotFoundErr,SheetName));
Help me, please!!!
0
Answers
-
Refactoring the code might help, i.e. instead of...
EndOfLoop := XlWrkBkRTC.Worksheets.Count;
...change it to...XlWrkShtsRTC := XlWrkBkRTC.Worksheets; EndOfLoop := XlWrkShtsRTC.Count;
...obviously you'll need a new variable for XlWrkShtsRTC to hold the Excel Worksheets (plural)0 -
Refactoring the code might help, i.e. instead of...
EndOfLoop := XlWrkBkRTC.Worksheets.Count;
...change it to...XlWrkShtsRTC := XlWrkBkRTC.Worksheets; EndOfLoop := XlWrkShtsRTC.Count;
...obviously you'll need a new variable for XlWrkShtsRTC to hold the Excel Worksheets (plural)
Kishorm
I Wrote
i := 1;
//EndOfLoop := XlWrkBkRTC.Worksheets.Count;
XlWrkShtsRTC := XlWrkBkRTC.Worksheets;
EndOfLoop := XlWrkShtsRTC.Count;
new variable XlWrkShtsRTC = Microsoft.Office.Interop.Excel.Worksheets.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
New Error
Message: System.__ComObject.Count: Object does not match target type.
0 -
Hmmm, I'm not sure you're going to have much luck with this, I found the following post...
forum.mibuso.com/discussion/62541/excel-interop-runonclient-no0 -
Check If all dotnet variables have set same value for property runonclient. All false or all true. If Run trough nas then all false.best regards
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/0 -
Hmmm, I'm not sure you're going to have much luck with this, I found the following post...
forum.mibuso.com/discussion/62541/excel-interop-runonclient-no
Thanks for the info.
I have installed a language pack, but the error remained.
It is a horror ((((0
Categories
- All Categories
- 75 General
- 75 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
