Excel automation

Marcel
Member Posts: 26
I'm using automation to export the item sales to Excel. It's working perfect but when the sales are negative, the exported value is formated as text in Excel.
(€ 1248- instead of -1248).
I tried to solve it with the following code:
Sheet.Range('B:M').NumberFormat := '#.##0;-#.##0';
But this is not working. Does anyone know the solution for this problem?
(€ 1248- instead of -1248).
I tried to solve it with the following code:
Sheet.Range('B:M').NumberFormat := '#.##0;-#.##0';
But this is not working. Does anyone know the solution for this problem?
Best Regards,
Marcel Bierens
Marcel Bierens
0
Comments
-
Hi Marcel,
I am sorry not to respod to your initial question, but after what you have wrote you might be able to help me with a little automation problem ( I am in the beginnings...).
I am trying to export sales data to excel and I just don't find the function to tell excel with c/side code to swith to the next cell in a column once it has filled it with data. The Range command does not accept variables...
Help is really appreciated...Never change a running system...0 -
Report (or Alexander),
When you use this
xlsheet.Range('A' + FORMAT(i)).Value := 'some value';
you can use the i variable to move to the next row.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
Thanks alot Luc Van Dyck,
I have tried every possible order of these commands and FORMAT but it was the '+' that made all the difference...
Thank God for the Forums...Never change a running system...0 -
I know, it's been 8 years.
but, since I've just had the same problem and solved it (for my case at least) I thought: let's post the solution here.
Worksheet.Range('A'+FORMAT(Row)).Value := format(FieldName, 0, 0);
Worksheet.Range('A:A').NumberFormat := '#.##0;-#.##0';
what this does is make a string from the number in a standard format.
then we place that in the cell.
Afterwards we give the cell the format we want it to have in Excel.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