Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Decimal places in excel
Message
From
25/09/2006 10:41:55
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01155911
Message ID:
01156919
Views:
27
This message has been marked as the solution to the initial question of the thread.
Mark,
OleApp.cells.NumberFormat

OleApp.cells means all cells.

Instead of:
>
>OleApp.cells(lnCounter,3).Select   && selects the individual cell
>OleApp.cells.NumberFormat = "[$€-2] #,##0.00"   && change the format of cell
>
Try:
 OleApp.cells(lnCounter,3).NumberFormat = "[$€-2] #,##0.00"   && change the format of cell
Cetin


>thanks for the replies, i have only gotten to this now as i was out sick.
>I have tried the suggestions but when i do all of the other fields with numeric values in them also get a € format attached to them. i have used
>
>OleApp.cells(lnCounter,3).Select   && selects the individual cell
>OleApp.cells.NumberFormat = "[$€-2] #,##0.00"   && change the format of cell
>
>i have also used
>
>...
>OleApp.cells.NumberFormatLocal = "[$€-2] #,##0.00"
>
>with the same results. the other fileds that are converted to numberic format are on other lines of the excel sheet, some well before these lines and some afterwards.
>~M
>
>>>hi all,
>>>I have an app that creates an excel file and everything hunky dorey except one thing. the customer wants to see 2 decimal points in a numberic field and also a lead char of the euro sign. i have tried passing in the values below but all that shows up in excel is the value without the euro sign. has anyone any ideas? Idealy automatically formating the cell to numeric with 2 decimal places and using the euro symbol would be best i think but i don't know now to do it.
>>>
>>>"€ " + ALLTRIM(STR(mvalue,9,2))
>>>
>>>~M
>>
>>
NumberFormat = "[$€-2] #,##0.00"
>>ie:
lcSQL = 'select product_id,quantity,unit_price,quantity*unit_price as extPrice from orditems'
>>lcConnPath = _samples+'data\testdata.dbc'
>>lcConnectionString = [OLEDB;Provider=VFPOLEDB;Data Source=]+m.lcConnPath
>>
>>* Create and save XLS once
>>oExcel = Createobject('Excel.Application')
>>With oExcel
>>  .Visible = .t.
>>  .Workbooks.Add
>>  With .ActiveWorkbook.ActiveSheet
>>    .QueryTables.Add( m.lcConnectionString, ;
>>    .Range("A1"),;
>>      m.lcSQL).Refresh
>>    .UsedRange.Columns(4).NumberFormat =  "[$€-2] #,##0.00"
>>  EndWith
>>EndWith
>>
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform