Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving and closing Excel file properly
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01396469
Message ID:
01396626
Views:
58
1. I'm not sure what the cFichier variable is set to, but the problem could be that the file name is missing a backslash and has a double extension. I would use the FORCEEXT() function just to be safe.
cFichier = "C:\FolderName\FileName.XLS"

* this command sets the variable to "C:\FolderNameFileName.XLS.csv"
cNewFichier = JUSTPATH(cFichier) + JUSTFNAME(cFichier) + ".csv"

* this command sets the variable to "C:\FolderName\FileName.CSV"
cNewFichier = FORCEEXT(cFichier, "CSV")
2. If you want Excel to save the file as a certain type (i.e. CSV, XML, TXT), use the FileFormat parameter.
* this command saves the file as xlCSV
.SaveAs(cNewFichier, 6)
3. If you want to close a document without being prompted to save changes, use the SaveChanges parameter.
* this command closes the document without any prompts to save
.Close(0)
Frank
Previous
Reply
Map
View

Click here to load this message in the networking platform