Nachfolgender Tipp zeigt, wie sich eine bereits geladene Instanz von Excel/Word/Access verwenden lässt, bzw. eine neue Instanz gestartet wird, falls die Applikation noch nicht gestartet ist. Beispiel: Microsoft Excel Dim oExcel As Object On Error Resume Next ' Excel verwenden, falls bereits gestartet Set oExcel = GetObject(, "Excel.Application") If oExcel Is Nothing Then ' Excel starten Set oExcel = CreateObject("Excel.Application") End If If oExcel Is Nothing Then ' Fehler: Excel nicht vorhanden! ... End If On Error Goto 0 Beispiel: Microsoft Word Dim oWord As Object On Error Resume Next ' Word verwenden, falls bereits gestartet Set oWord = GetObject(, "Word.Application") If oWord Is Nothing Then ' Word starten Set oWord = CreateObject("Word.Application") End If If oWord Is Nothing Then ' Fehler: Word nicht vorhanden! ... End If On Error Goto 0 Beispiel: Microsoft Access Dim oAccess As Object On Error Resume Next ' Access verwenden, falls bereits gestartet Set oAccess = GetObject(, "Access.Application") If oAccess Is Nothing Then ' Access starten Set oAccess = CreateObject("Access.Application") End If If oAccess Is Nothing Then ' Fehler: Access nicht vorhanden! ... End If On Error Goto 0 |