Sauvegarde EXCEL

cs_othland Messages postés 298 Date d'inscription jeudi 18 décembre 2003 Statut Membre Dernière intervention 9 février 2010 - 17 oct. 2006 à 14:50
yvessimon Messages postés 637 Date d'inscription mardi 22 avril 2003 Statut Membre Dernière intervention 9 janvier 2017 - 19 oct. 2006 à 08:59
slt tlm;
j'ai une application delphi qui sauvegarde une table dans un fichier EXCEL, j'ai utilisé la méthode suivante:
OleWorkBook.SaveAs['C:\dell\exc001'];
mon problème c'est lors d'une 2emme execution de mon application, WINDOWS me demande est ce que je veux ecraser mon fichier exsitant ou pas, moi, je ne veux pas que cette fenêtre s'affiche et je veux aussi que WINDOWS l'écrase directement, avez vous une solution???
merci

2 réponses

ZEGHBAABBES Messages postés 4 Date d'inscription dimanche 1 octobre 2006 Statut Membre Dernière intervention 17 mars 2008
17 oct. 2006 à 15:21
Salut
Pour résoudre votre problème il faut utiliser la commande
/////// if FileExists(SaveDialog1.FileName) then
pour tester si le fichier existe ou pas dans le répertoire C:\dell\
/////////
et voir la fonction copyfile

BOOL CopyFile(
LPCTSTR lpExistingFileName, // pointer to name of an existing file
LPCTSTR lpNewFileName, // pointer to filename to copy to
BOOL bFailIfExists // flag for operation if file exists
);
Parameters

lpExistingFileName

Points to a null-terminated string that specifies the name of an existing file.

lpNewFileName

Points to a null-terminated string that specifies the name of the new file.

bFailIfExists

Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
0
yvessimon Messages postés 637 Date d'inscription mardi 22 avril 2003 Statut Membre Dernière intervention 9 janvier 2017
19 oct. 2006 à 08:59
regarde avec
XL.DisplayAlerts := True ; // ...

yvessimon
0
Rejoignez-nous