[R] fermer un fichier excel

Aide et conseils concernant AutoIt et ses outils.
Règles du forum
.
Répondre
emanemos
Niveau 4
Niveau 4
Messages : 61
Enregistré le : sam. 26 nov. 2011 12:39
Status : Hors ligne

[R] fermer un fichier excel

#1

Message par emanemos »

Bonjour,

je n'arrive pas à enregister & fermer le fichier !!!!! je bloque après le msgbox ....

Une idée ???

Code : Tout sélectionner

$oExeResult = _SQLQuery($Db_oConn, "SELECT * FROM Exclus;" )

Local $oAppl = _Excel_Open (True,False,True,True,True)
$oWorkbook = _Excel_BookNew($oAppl, 1)
$oAppl.ActiveWorkBook.ActiveSheet.Cells(1,1).CopyFromRecordset ($oExeResult)
local $RowCount = $oWorkbook.ActiveSheet.UsedRange.Rows.Count
Msgbox(1,"Liste noire", "Il existe " & $RowCount & " lignes dans le fichier")
_Excel_BookSaveAs($oWorkbook, $path & $Res & "ssh_exclus1.csv", "csv",true)
_Excel_BookClose($oWorkbook)
Avatar du membre
orax
Modérateur
Modérateur
Messages : 1479
Enregistré le : lun. 23 mars 2009 04:50
Localisation : ::1
Status : Hors ligne

Re: [R] fermer un fichier excel

#2

Message par orax »

Je ne pense pas que "csv" soit un format. Dans la doc pour _Excel_BookSaveAs()
$iFormat [optional] Excel writeable filetype. Can be any value of the XlFileFormat enumeration.

Starting with Excel 2007 you have to provide both the $iFormat parameter and the correct file extension in $sFilePath.
E.g. $iFormat = $xlExcel8 and extension = "xlsx" will return an error.
Please see the XlFileFormat enumeration in ExcelConstants.au3 for possible values.

Code : Tout sélectionner

; XlFileFormat Enumeration. Specifies the file format when saving the worksheet.
; See: http://msdn.microsoft.com/en-us/library/ff198017(v=office.14).aspx
[...]
Global Const $xlCSV = 6 ; CSV
Global Const $xlCSVMac = 22 ; Macintosh CSV
Global Const $xlCSVMSDOS = 24 ; MSDOS CSV
Global Const $xlCSVWindows = 23 ; Windows CSV
De petits détails peuvent faire toute la différence. — Quand la boule de neige commence à rouler… poussez-la. (Columbo)
Répondre