Information générale
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Network:
Windows 2000 Server
>Hi,
>
>I'm trying to format a column in an excel spreadsheet into a date format with excel automation.
>
>The following code:
>
>oExcel = CreateObject("Excel.Application")
>oWOSRWorkBooks = oExcel.WorkBooks.Open(tcXLFile)
>oExcel.Visible = .T.
>oWOSR = oWOSRWorkBooks.WorkSheets[1]
>oWOSR.Columns("Q").NumberFormat = "dd/mm/yyyy" && Format to date
>
>appears to work until I open the spreadsheet, right click on the desired column and click on "Format Cells". The category has been set to "Custom". I want it to be set to "Date". Does anyone know how to use excel automation to set the format of a column to "Date"?
>
Try automating Excel from the Command Window, and then interactively (in Excel) setting the format for a cell to the format you want, choosing one of the date formats. From the Command Window, read the NumberFormat property, then use that one in your code.
Tamar
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement