Excel Automation Control

daroon
Member Posts: 35
Hi i just wanne put some decimals into an Excel-Sheet
with the function
worksheet.range('A1').value := number;
But in excel there are only 2 decimal places all the time, but i really need 5 decimal places. In Navision this Variable has all the decimal places !
What should i do ?
with the function
worksheet.range('A1').value := number;
But in excel there are only 2 decimal places all the time, but i really need 5 decimal places. In Navision this Variable has all the decimal places !
What should i do ?
0
Comments
-
Just add a format to your value:
worksheet.range('A1').Format := '#,##0.00000';
Depending on language Version you must enter the local number format (e.g. in Germany you need to use '#.##0,0000' instead of upper string.0 -
Sorry was a little mistake of mine.
You must use the Property "NumberFormat" instead of "Format" like shown below:
Range('C:G').NumberFormat := '#.##0,00000';
Another way is to use the Property NumberFormatLocal. As shown in VBA-Description the NumberFormat should be in international form #,##0.00 while NumberFormatLocal should be the local format code like '#.##,00'. But unlike in VBA in my tests only the local format did work in both properties.
Range.NumberFormatLocal := '#.##0';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