benutze folgenden Code:
Option Explicit
Sub Call_InstanceCheck()
'MsgBox InstanceCheck("outlook")
If InstanceCheck("Outlook") = False Then
UF_HINWEIS.Show
Else
If InstanceCheck("Outlook") = True Then
UF_NEUE_BESTELLUNG_EINTRAGEN.Show
End If
End If
End Sub
Function InstanceCheck(Server As String) As Boolean
Dim myInstance As Object
InstanceCheck = False
On Error Resume Next
Select Case UCase(Server)
Case "EXCEL"
Set myInstance = GetObject(, "excel.application")
Case "OUTLOOK"
Set myInstance = GetObject(, "outlook.application")
Case "WORD"
Set myInstance = GetObject(, "word.application")
End Select
If Not myInstance Is Nothing Then InstanceCheck = True
On Error GoTo 0
Set myInstance = Nothing
End Function
Bei UF_HINWEIS ist ein CommandButton der inaktiv ist und aktiv werden soll, sobald Outlook geöffnet worden ist.
Wie kann ich oben genannten Code ind eine "Schleife" legen (evtl. Sekundentakt?) wo überprüft wird ob Outlook nun geöffnet ist und der ComButton aktiv (enabled) wird?
Gruss Gegga