Referring to Cells in Excel by Using Index Numbers

smatijev
Member Posts: 12
Has anybody managed to refer to cells in Excel in any way other than by Range (A1 notation)? To be precise, I'm interested in referring to cells using index number. I tried to use
to put SomeValue into cell B3 as it is stated in VB help but id doesn't work in Navision because Cells doesn't take any arguments.
Also, any idea how to add worksheet so that it is the last sheet? I looked in help and it says
Thanks
WorkSheet.Cells(2, 3).Value := SomeValue
to put SomeValue into cell B3 as it is stated in VB help but id doesn't work in Navision because Cells doesn't take any arguments.
Also, any idea how to add worksheet so that it is the last sheet? I looked in help and it says
but it doesn't help much.expression.Add(Before, After, Count, Type)
Thanks
0
Comments
-
In Tools/Options/General you can set the option R1C1 Reference style checked, which changes to column names to numbers.
I do however not know if this makes it possible to refer to cells through numbers in VB script ...
Jens0 -
smatijev wrote:Also, any idea how to add worksheet so that it is the last sheet? I looked in help and it saysexpression.Add(Before, After, Count, Type)
I managaed way to do this is by creating macro in template and then calling it from Navision.0 -
Very interesting, could you show an example of the code?0
-
Maybe a little late for an answer but i think you have to do this:
VAR: Range : 'Microsoft Excel 11.0 Object Library'.Range App : 'Microsoft Excel 11.0 Object Library'.Application Workssheet : 'Microsoft Excel 11.0 Object Library'.Worksheet nCount : integer // ----------------- CREATE(App); // you probably already did that ... // your 2nd problem nCount := App.Worksheets.Count; Worksheet := App.Worksheets.Add(0,nCount); // your 1st problem Range := WorkSheet.Cells.Item(2,3); Range.Value := SomeValue;
I did not test it, but with this code i think you are close. The only thing i'm not sure of if the worksheets.add works with that 0. Play a little with it. Its an optional paramter but navision does require you to give something.
With your first problem you forgot Item. In VB this is the default property so in VB it is not required. Navision does not know such thing as default property so you have to give the name of the default property (item).In a world without Borders or Fences, who needs Windows and Gates?0 -
...In a world without Borders or Fences, who needs Windows and Gates?0
-
To Your first problem - I think the simplest way is something like this:
xlWorkSheet.Range('A1').Value := 'Text';
0 -
=D> You reply became many help in me.
Thanks~0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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