spootnic22
Messages postés84Date d'inscriptionmardi 31 octobre 2006StatutMembreDernière intervention30 janvier 2010
-
13 nov. 2006 à 09:47
spootnic22
Messages postés84Date d'inscriptionmardi 31 octobre 2006StatutMembreDernière intervention30 janvier 2010
-
13 nov. 2006 à 16:10
Salut,
Pourriez vous me dire comment la sauvegarde des fichiers html dans un repertoire sans passé par le biais da boites de dialogue CommonDialog.ShowSave?
Merci Bcp.
spootnic22
Messages postés84Date d'inscriptionmardi 31 octobre 2006StatutMembreDernière intervention30 janvier 2010 13 nov. 2006 à 16:10
Salut,
voici le code que j'ai fait pour ce problème:
-------------------------------------------------------
Private Sub Command2_Click()
Dim src, nomfich, NumFich, sPath, MyPath As String
Dim x, i, p, j As Integer
Dim sDate, sr As String
Dim trouver As Boolean
src = WebBrowser1.Document.documentElement.outerHTML
For x = 0 To WebBrowser1.Document.links.length - 1
List1.AddItem (WebBrowser1.Document.links(x))
Next
i = FreeFile
sDate = Format(Date, "yyyymmdd")
sPath = "D:\Production\EBP\Source" & sDate
j = 1 If (MyPath Dir(sPath, vbDirectory)) vbEmpty Then
CommonDialog1.InitDir = sPath
CommonDialog1.FileName = "Annonce" & j & ".html "
nomfich = Me.CommonDialog1.FileName
If Dir(nomfich, vbNormal Or vbReadOnly Or vbHidden Or vbArchive) = "" Then
CommonDialog1.FileName = "Annonce" & j & ".html "
nomfich = Me.CommonDialog1.FileName
Open nomfich For Output As #i
Print #i, src
Close #i
Else
j = j + 1
CommonDialog1.FileName = "Annonce" & j & ".html "
nomfich = Me.CommonDialog1.FileName
Open nomfich For Output As #i
Print #i, src
Close #i
End If
Else
MkDir "D:\Production\EBP\Source" & sDate
CommonDialog1.InitDir = sPath
CommonDialog1.FileName = "Annonce" & j & ".html "
nomfich = Me.CommonDialog1.FileName If MyPath Dir(nomfich, vbNormal Or vbReadOnly Or vbHidden Or vbArchive) "" Then
CommonDialog1.FileName = "Annonce" & j & ".html "
nomfich = Me.CommonDialog1.FileName
Open nomfich For Output As #i
Print #i, , src
Close #i
Else
j = j + 1
CommonDialog1.FileName = "Annonce" & p & ".html "
nomfich = Me.CommonDialog1.FileName
Open nomfich For Output As #i
Print #i, , src
Close #i
End If
End If
End Sub
----------------------------------------------------------
à l'execution, l'application sauvegarde seulement 2 fichiers "Annonce1.html" et "Annonce2.html" mais moi je veux qu'à chaque sauvegarde le fichier Annonce.html sera sauvegarder en incrémantant le conteur dans la même session.
Merci Bcp.