Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Transfer Excel file to DBF file automatically within VFP
Message
De
19/03/2003 08:33:56
 
 
À
19/03/2003 00:35:12
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00765739
Message ID:
00767474
Vues:
23
I have the next code.

Local cDbf, cDbfTemp, cPath
Close Tables All

m.carchivo = 'F:\Excelfile' && Execl File
m.cPath = 'c:\Files\'&& dbf Path
m.cDbfTemp = 'c:\'+ Sys(3)+'.dbf' && Temp file

* genera el nombre de la tabla Fox
* Generate Fox table name
m.cDbf = m.cPath+ JustFName(m.cArchivo) + '.dbf'

* Abre Excel, muestra todas las columnas y salva como DBF4
* Open Excel, Show all columns as save as DBF4
oObject=Create("Excel.Application")

oobject.WorkBooks.Open(m.cArchivo)

oobject.Cells.Select
oobject.Selection.EntireColumn.Hidden = .f.
oobject.Range("A1").Select

* Sí ya existe el archivo, hace ZAP e inserta para preservar el tamaño de los campos
* If file exists, Zap it and insert new data
If File(m.cDbf)
oobject.ActiveWorkbook.SaveAs(m.cDbfTemp,11)
oobject.ActiveWindow.Close(.F.)

* cambia la página de códigos a 437
* Optional. I need it for Spanish (áéíóúñÑ)
cpZero(m.cDbfTemp,437)
Use (m.cDbf) Exclusive
Zap
Append From (m.cDbfTemp)
Erase (m.cDbfTemp)
Else
Use in Select(m.cDbf)
oobject.ActiveWorkbook.SaveAs(m.cDbf,11)
oobject.ActiveWindow.Close(.F.)

* cambia la página de códigos a 437
cpZero(m.cDbf,437)
EndIf

Return
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform