Hallo,
aus dem Homeoffice heraus suche ich den Draht nach draußen und euren Rat.
Auf computer@office treten bei einem Makro zufällig folgende Laufzeitfehler auf, auf computer@HomeOffice nicht:
computer@office: Nachdem ich einige Male, mal mehr mal weniger häufig, auf Debuggen geklickt und mit F5 die Fortsetzung des Makros angestoßen habe, läuft das Makro schlussendlich doch ohne weitere Unterbrechungen durch.
aus dem Homeoffice heraus suche ich den Draht nach draußen und euren Rat.
Auf computer@office treten bei einem Makro zufällig folgende Laufzeitfehler auf, auf computer@HomeOffice nicht:
computer@office: Nachdem ich einige Male, mal mehr mal weniger häufig, auf Debuggen geklickt und mit F5 die Fortsetzung des Makros angestoßen habe, läuft das Makro schlussendlich doch ohne weitere Unterbrechungen durch.
Quellcode
- Sub extract_userpicture_from_comments
- Dim rngZelle As Range
- Dim xRg As Range
- Dim visBool As Boolean
- Dim cmtTxt As String
- Dim i As Integer
- If ActiveSheet.Comments.Count = 0 Then
- MsgBox "No comments in entire sheet"
- Exit Sub
- End If
- Application.CutCopyMode = False
- Application.ScreenUpdating = False
- Application.Calculation = xlCalculationManual
- For Each rngZelle In Selection.Cells
- With rngZelle
- rngZelle.Select
- If .Comment Is Nothing Then
- GoTo LabelA
- Else
- With .Comment
- cmtTxt = .Text
- .Text Text:="" & Chr(10) & ""
- visBool = .Visible
- .Visible = True
- .Shape.CopyPicture _
- Appearance:=xlScreen, Format:=xlPicture
- Set xRg = .Parent.Offset(0, 1)
- xRg.PasteSpecial
- Selection.ShapeRange.LockAspectRatio = msoTrue
- Selection.Height = xRg.Height
- .Visible = visBool
- .Text Text:=cmtTxt
- .Shape.Fill.Solid
- .Shape.TextFrame.AutoSize = True
- i = i + 1
- Debug.Print i; rngZelle.Address
- End With
- End If
- End With
- LabelA:
- Application.CutCopyMode = False
- Next rngZelle
- Application.CutCopyMode = False
- Application.Calculation = xlCalculationAutomatic
- Application.ScreenUpdating = True
- End Sub