Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP to Excel data format problem
Message
De
09/01/2001 12:54:38
 
 
À
09/01/2001 11:47:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00461214
Message ID:
00461299
Vues:
13
OK, it's not ODBC, it's automation. What I don't see in your code is the code passing the table data over to Excel. That code is probably further on, eh? Anyway, if you are passing the character data by setting the .Value of the Cell or Range directly to the field, then it's sent as Text and no numeric formatting will affect it. The Value of the Cell or Range has to be set to a numeric.

You can use the VFP VAL() function to do this, provided you SET DECIMALS to the maximum number of decimals first or you can use the Formula property in Excel if you want to dump the character data into a cell and then something like .ActiveSheet.Range("A1").Formula = "=Value(Z1)"


>Sorry...let me see if i can explain this better.
>When the user clicks on "save to excel" it calls a blank template that we have set up which is what they will use.
>Then we create an Excel Object "x1 = CREATEOBJECT("EXCEL.APPLICATION")".
>Using this object we do some fox table data tweeking to get exactly what we want to dump into excel. Once that is all done we have the "DO Excel WITH".
>
>Here is some sample code that I am thinking is are ODBC calls (?):
>
>x1.Workbooks.Open('path'+'xtab1.xls')
>x1.Sheets("xtab1").Name = "Legend"
>....
>x1.Cells.Replace("|", ",", 2, 1, .f.)
>
>x1.Columns("C:F").Select
>x1.Selection.Insert(-4152)
>
>I hope this helps.
>
>
>>Huh, what? OK....explain this whole thing in a bit more detail. I think there is a solution to your problem but the problem is vague :-)
>>
>>>Looks like it is probably ODBC...then there is a 'DO Excel WITH...' call which is when Excel actually opens.
>>>
>>>
>>>>How are you "saving into Excel"?
>>>>
>>>>>I have a FoxPro table that I am saving into Excel. Some numerical fields in FoxPro have to be set as Char to allow the correct amount of decimal points to show. When this data is saved into excel, it does not allow you to format the fields to change them to number so that analysis may be done. The only way to change them is to edit every field. I can't seem to figure out why it won't allow me to change the formatting. Something seems to be holding the char format in Excel.
>>>>>
>>>>>Any ideas?
>>>>>
>>>>>Thanks!
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform