Shell strTh & strCommand, vbNormalFocus
16.03.2022 00:22:16
Jack.k32
ich habe ein Paar Makros, das ich seit einiger Zeit problemlos nutze. Nun habe ich mir einen neuen Rechner zugelegt und die personal.xlsb in das neue Excel eingefügt. Leider funktionieren auf dem neuen PC mehrere Makros, die zum Schluss eine Email via Thunderbird generieren sollen, nicht mehr.
Auf dem alten PC Winwows 10 ist alles einwandfrei nach wie vor.
Alter PC Win10 und Neuer PC Win11: Version Excel 2202 ( Build 14931.20132 Klick-und-los) - auf beiden die gleiche
Fehlermeldung Laufzeitfehler 53, Datei nicht gefunden und weist auf diese Zeile hin: Shell strTh & strCommand, vbNormalFocus
Die Datei Packliste.xlsx wird geöffnet, modifiziert, gespeichert, angezeigt - alles OK. Eine Email in Thunderbird wird nicht generiert.
Vielleicht weiß ja jemand einen Rat? Besten Dank im Voraus!
Hier z.B:
Sub Packliste()
' Packliste Makro
Selection.Copy
Application.ScreenUpdating = False
Workbooks.Open Filename:= _
"C:\Users\aaa\bbb\Datenbank\Packliste.xlsx"
Range("A1").Select
ActiveSheet.Paste
Range("A:E").Select
Application.CutCopyMode = False
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("A1").Sort Key1:=Range("A1"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom
Windows("ccc.xlsx").Activate
ActiveCell.Offset(0, -4).Select
Selection.Copy
ActiveCell.Offset(0, 15).Select
ActiveCell.Value = Date
Windows("Packliste.xlsx").Activate
Range("D1").Select
ActiveSheet.Paste
Range("D1").Select
Selection.Copy
ActiveSheet.PageSetup.CenterHeader = Format(Range("D1").Value)
ActiveSheet.PageSetup.CenterHeader = Format(Range("D1").Value)
Range("D1").ClearContents
Range("D2").Copy
Range("D1").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\aaa\Downloads\Packliste.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
strTh = "C:\Program Files (x86)\Mozilla Thunderbird\Thunderbird.exe "
strCommand = "-compose to=aaa@gmail.com" & _
",subject='Packliste',body=''" & _
",from=bbb@ccc.eu" & _
",attachment='file:///C:\Users\aaa\Downloads\Packliste.pdf'"
Shell strTh & strCommand, vbNormalFocus
Workbooks("Packliste.xlsx").Close SaveChanges:=False
Application.ScreenUpdating = True
End Sub