Mit VBA Word aus Excel starten, hier: auf Mac!

Ich habe eine Lösung statt ein Problem (Dank an Stefan für seine erste Hilfe.)
Inzwischen fand ich raus, warum VBA in Mac einen zusätzlichen Fehlercode abfragen muss, wenn aus Excel Word gestartet werden soll. Da in Mac ein Programm in hintergrund offen sein kann ohne dass ein dokument dazu existiert, muss man folgende zeile einfügen, damits funktioniert:

If Err = -2147221002 Then appWord.Activate: GoTo ende

Insgesamt lautet der Code dann:

Sub wordaufruf()
Dim appWord As Word.Application
Dim dok As Object
On Error Resume Next
Set appWord = GetObject(, „Word.Application“)
If Err 0 Then
Err = 0
Set appWord = CreateObject(„Word.Application“)
Else
If Not app.Word.Visible Then
Err = 0
Set appWord = CreateObject(„Word.Application“)
End If
End If
If Err 0 Then
If Err = -2147221002 Then appWord.Activate: GoTo ende
MsgBox Err & „Word nicht gefunden!“, vbOKOnly + vbCritical, „!!! Problem !!!“
Exit Sub
End If
ende:
appWord.Visible = True
With appWord
If .Documents.Count = 0 Then
Documents.Add
End If
End With
appWord.Selection.TypeText Text:=„bla bla bla“
End Sub

Prima
Hallo Richard,

Prima dass es doch noch geklappt hat.
Hurra und Glückwunsch!

Stefan