excel help please!

Five
Member Posts: 32
Hello all,
I am new at navision and have a couple of questions.
i have developed a report that exports to an excel file that already exists.The export works fine but the problem is the excel fine already has data and data keeps getting over written.My question is
' Is there a way of finding the row number of the last record in the excel file?So that i can place my data in the next row.
below is the code:
j := '5';
REPEAT
Sheet.Range('A'+j).Value := Item."No." ;
Sheet.Range('B'+j).Value := Item.Description;
j:=INCSTR(j);
UNTIL ItemHistory.NEXT = 0;
etc etc
but the next time i open the file j won't be 5 it will be six
j is hardcoded...i would like j to be the next empty row in the excel file.
Thanks to all that reply..
I am new at navision and have a couple of questions.
i have developed a report that exports to an excel file that already exists.The export works fine but the problem is the excel fine already has data and data keeps getting over written.My question is
' Is there a way of finding the row number of the last record in the excel file?So that i can place my data in the next row.
below is the code:
j := '5';
REPEAT
Sheet.Range('A'+j).Value := Item."No." ;
Sheet.Range('B'+j).Value := Item.Description;
j:=INCSTR(j);
UNTIL ItemHistory.NEXT = 0;
etc etc
but the next time i open the file j won't be 5 it will be six
j is hardcoded...i would like j to be the next empty row in the excel file.
Thanks to all that reply..
Compile and then Recompile ....
0
Comments
-
There is a standard table called Excel Buffer (ID 370).
This has functions for importing and exporting excel worksheets.
Why not do the following.
If File Exists then
import worksheet into Excel buffer;
Excel Buffer.Find last (it is keyed on Row No, Col No. so this will return the last row that is in the file, If the file didn't exist then this will be 0 as no record would have been found).
Increment the row no.
Carry on populating the Excel buffer.
When finished
Use Excel Buffer function to export to Excel.
If you need any help using the Excel Buffer table then don't hesitate to askThis isn't a signature, I type this at the bottom of every message0 -
HI Steve,
I am new to Navision and working on Navision v4.0 sp3 with no add ons. I want to export data to Excel. Kindly help. i am in a big fix and have been banging my head with Navision ](*,) but all in vein.
Please please please help.
Regards,
Murtaza0 -
I think with automation variable it very much difficult to add new row at end.
You have to use excel buffer , import excel sheet then use findlast before inserting new row.
Or at the time of writing report you can check that current record contains a value or not.
Have to try.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