Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Save as Excel File problem
Message
De
26/02/2009 22:06:47
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Save as Excel File problem
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01384455
Message ID:
01384455
Vues:
89
Hi,
I have a program to read in a .CSV file which the column fields separated by comma,
and I want to convert it to a Excel File. (one column for one field)
The following is the code:-
crptfile="C:\TEMP\CLIENT.CVS"   
ctargetfile="C:\TEMP\CLIENT.XLS"
TRY
  oExcel = CREATEOBJECT([Excel.Application])
  oWorkbook = oExcel.Workbooks.open(crptfile)
  oExcel.Visible = .t.
  oWorkbook.Window[1].Activate()
  oExcel.ActiveSheet.Range("A1:K1000").Columns.AutoFit()	  	
  oWorkbook.SaveAs(ctargetfile) 
CATCH
  MessageBox([There is no EXCEL installed])
ENDTRY
the worksheet prompt out in Excel is normal, one column for one field,
After exit Excel application, I reopen the excel, I find that although the target file is Excel format,
the detail is still in cvs format, only the first column contain the data.
for example in the first column contain "aaa,bbb,ccc,ddd,...",
I suppose column A1 contain "aaa", column B1 contain "bbb", column C1 contain "ccc".....

How to solve this problem, please advise.

Thanks
Derek Yim
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform