'Log pour lister les commentaires dans les cellules

  • Initiateur de la discussion Ludo
  • Date de début
L

Ludo

Guest
Re re bonjour


La macro ci-dessous me permet de générer un fichier txt pour tous les commentaire dans les cellules. Le problème est toujours lié à la compatibilité sur Excel 97 (macro pour XP), qu'il ne me liste pas les commentaires qui ont été renommés et que je dois lancer la macro manuellement. Alors si quelqu'aurait quelque chose de mieux alors bienvenue.

Merci

Ci-dessous la macro

Ludo

Sub Commentaire() 'Log pour lister les commentaires dans les cellules (uniquement au niveau formatio
Dim S As Shape
Dim Tbl() As String
Dim I As Integer
On Error Resume Next
Open ThisWorkbook.Path & "\Texte.txt" For Output As #1
For Each S In Worksheets("Feuil1").Shapes
If Left(S.TextFrame.Parent.Name, 7) = "Comment" Then
Print #1, S.TextFrame.Characters.Text
End If
Next
Close #1
Set S = Nothing
Erase Tbl
End Sub
 
A

A_binouze_drinker_among_others

Guest
bonjour

il faut nous signaler où visual basic t'indique une erreur si tu veux que l'on t'aide.

sinon, voilà un bout de code ci-dessous qui crée une log avec les commentaires


'<http://xlbysteph.free.fr/aideinformatique/actionaide.htm#20>
Sub writeComments()
dim mycomment As Comment, mySht As Worksheet
Open "C:\Test.txt" for Output As #1
for each mySht In worksheets
for each mycomment In worksheets(mySht.name).Comments
Print #1, "From " & mycomment.Parent.Parent.name _ & mycomment.Parent.address _ & " Comes the comment: " _ & mycomment.Text
next mycomment
next mySht
Close #1
end Sub

tu peux y rajouter par exemple l'instruction une condition, ce qui donnerait
If InStr(1, mycomment, "comment") > 0 Then
Print #1, "From " & mycomment.Parent.Parent.Name & mycomment.Parent.Address & " Comes the comment: " & mycomment.Text
End If

'cf aussi <http://xlbysteph.free.f/aideinformatique/actioncellule.htm>
 

Discussions similaires

Statistiques des forums

Discussions
312 330
Messages
2 087 337
Membres
103 524
dernier inscrit
Smile1813