Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Useful DBF2Excel routine
Message
De
02/03/2006 14:37:09
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01097203
Message ID:
01101041
Vues:
17
You could first format the column(s) as text before pasting the values:

* format column A as text
oExcel.Range("A:A").NumberFormat = "@"

>This is quick an easy, but how do you prevent character columns containing numbers from becoming numeric. For example a code like '0501' should not become 501.
>
>Einar
>
>>Another approach:
>>
>>
>>Local oExcel As "Excel.Application", loError As Exception
>>_Vfp.DataToClip(Select(),,3)
>>Try
>>	oExcel=CreateObject("Excel.Application")
>>Catch To loError
>>EndTry
>>With oExcel
>>	.Workbooks.Add()
>>	.Workbooks(1).Sheets(1).Paste
>>	.Workbooks(1).Sheets(1).Cells.Select
>>	.Workbooks(1).Sheets(1).Cells.EntireColumn.AutoFit
>>	.Visible=.T.
>>EndWith
>>
>>
>>
>>Luis Navas
>>>Oops, just googled Dbf2Excel and found FoxyClases is using that name for one of their classes. Sorry about that.
>>>
>>>Alex
>>>
>>>Hi,
>>>
>>>I needed this little routine and thought it may be useful to others:
>>>
>>>* DBF2Excel.prg This routine is meant to be called with a table open in current area
>>>* Creates table in FOX2X format and opens with Excel
>>>LOCAL lcTemp,loExcel
>>>lcTemp = FORCEPATH(SYS(2015) + '.tmp',SYS(2023))
>>>COPY TO (lcTemp) FOX2X
>>>loExcel = CREATEOBJECT('Excel.Application')
>>>loExcel.WindowState = -4137  && xlMaximized
>>>loExcel.Workbooks.Add(lcTemp)
>>>loExcel.Visible = .t.
>>>
>>>
>>>Alex
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform