Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Save as Excel File problem
Message
 
 
À
26/02/2009 22:06:47
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
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:
01384457
Vues:
45
Can you open the file manually, then record the macro to save it correctly?

>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
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform