Rubrik: COM/OLE/Registry/DLL · Automation | VB-Versionen: VB4, VB5, VB6 | 14.10.03 |
![]() Dieser 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. | ||
Autor: ![]() | Bewertung: ![]() ![]() ![]() ![]() ![]() | Views: 20.269 |
https://www.tools4vb.com | System: Win9x, WinNT, Win2k, WinXP, Win7, Win8, Win10, Win11 | ![]() |
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