AW: kann man Kommentare (per Makro) durchsuchen?
23.06.2008 14:51:27
Sirko
Hallo allerseits,
ich hatte nun Zeit, mit den verschiedenen Ansätzen zu experimentieren, komme aber doch nicht weiter...
...unten der Vollständigkeit halber der betreffende Code aus Mines Add-in...
Ich suche nach wie vor eine Möglichkeit, bei dem jetzigen ListBox2.RowSource = "G3:G" & x
auf die Kommentare SpecialCells(xlCellTypeComments) zu verweisen.
Viele Grüße
Sirko
Private Sub CommandButton1_Click()
UserForm1.Hide
End Sub
Private Sub CommandButton2_Click()
On Error Resume Next
Dim aw, nw As Workbook
Dim acs, ncs, aktblatt As Worksheet
Dim blaetter As Variant
Dim acl As Range
UserForm1.Hide
Application.ScreenUpdating = False
Set aw = ActiveWorkbook
Set acs = ActiveSheet
Set acl = Selection
Set nw = Workbooks.Add
Set ncs = nw.Worksheets(1)
i = 4
If UserForm1.OptionButton1 = True Then
For Each c In acs.Comments
ncs.Cells(i, 1) = c.Parent.Address(False, False)
ncs.Cells(i, 2) = c.Parent.Parent.Name
ncs.Cells(i, 3).Formula = c.Text
c.Delete
i = i + 1
Next c
Else
For Each aktblatt In aw.Worksheets
For Each c In aktblatt.Comments
ncs.Cells(i, 1) = c.Parent.Address(False, False)
ncs.Cells(i, 2) = c.Parent.Parent.Name
ncs.Cells(i, 3).Formula = c.Text
i = i + 1
c.Delete
Next c
Next aktblatt
End If
If i > 4 Then
ncs.Cells(3, 1).Formula = "Zelle"
ncs.Cells(3, 2).Formula = "Tabellenblatt"
ncs.Cells(3, 3).Formula = "Kommentartext"
ncs.Cells(3, 1).EntireRow.Font.Bold = True
ncs.Cells(4, 1).AutoFilter
For j = 1 To 3
ncs.Cells(1, j).EntireColumn.AutoFit
Next j
For j = 4 To i
ncs.Cells(j, 1).EntireRow.AutoFit
Next j
ncs.Range("a1") = "Kommentare aus Arbeitsmappe: " & acs.Parent.FullName
ncs.Range("a1").Font.Bold = True
ncs.Name = Left$("Kommentare aus " & acs.Parent.Name, 30)
Else
a = MsgBox("Es wurden keine Kommentare gefunden.", vbOKOnly, "Keine Kommentare gefunden")
ncs.Parent.Close
acs.Activate
End If
Application.ScreenUpdating = True
On Error GoTo 0
End Sub
Private Sub OptionButton1_Click()
End Sub