1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| Option Explicit
Sub AjouterUneLigneDansFichierTexte(CheminComplet As String, ContenuTexte As String)
Dim FF As Integer, dejala As String
FF = FreeFile
Open "Q:\Commun\ListeChangements.txt" For Input As #FF
dejala = Input(LOF(FF), #FF)
Close #FF
Open "q:\Commun\ListeChangements.txt" For Output As #FF
Print #FF, ContenuTexte & vbCrLf & dejala
Close #FF
End Sub
Sub couleurs()
'Epaisseur de la bordure
ActiveCell.Borders.Weight = 4
'Couleur de la bordure : rouge
ActiveCell.Borders.Color = RGB(255, 0, 0)
End Sub
Private Sub BoutonRazCouleurs_Click()
ActiveSheet.UsedRange.Interior.ColorIndex = xlNone
End Sub
Private Sub CommandButton1_Click()
Dim Chaine As String
Dim Fichier As String
On Error GoTo Erreur
Fichier = "q:\Commun\ListeChangements.txt"
If ActiveCell.Row < 3 Then Exit Sub
With ActiveCell
If Not (.Comment Is Nothing) Then
Chaine = " - Modifié le " & Now & " => " & Cells(ActiveCell.Row, 1) & "," & ActiveCell & "," & Cells(55, ActiveCell.Column) & "," & .Comment.Text & "(" & ActiveCell.Address & ")"
Else
Chaine = " - Modifié le " & Now & " => " & Cells(ActiveCell.Row, 1) & "," & ActiveCell & "," & Cells(55, ActiveCell.Column) & "(" & ActiveCell.Address & ")"
End If
'Epaisseur de la bordure
ActiveCell.Borders.Weight = 4
'Couleur de la bordure : rouge
ActiveCell.Borders.Color = RGB(255, 0, 0)
End With
AjouterUneLigneDansFichierTexte Fichier, Chaine
' MsgBox "Les cellules ont été sauvegardées dans " & Fichier
Exit Sub
Erreur:
MsgBox "Le fichier de sortie est inaccessible"
End Sub
Private Sub CommandButton2_Click()
On Error GoTo OuvertureFichierErreur
Dim MonApplication As Object
Dim MonFichier As String
Set MonApplication = CreateObject("Shell.Application")
MonFichier = "q:\Commun\ListeChangements.txt" 'à remplacer par votre fichier
MonApplication.Open (MonFichier)
Set MonApplication = Nothing
Exit Sub
OuvertureFichierErreur:
Set MonApplication = Nothing
MsgBox "Erreur lors de l'ouverture de fichier..."
End Sub |
Partager