AppActivate Excel-vba: Excel blinkt in der Taskleiste und wird nicht aktiviert

834
Riccardo La Marca

In einem Excel-vba-Modul:

Option Explicit Sub Test() Dim Outlook As Object Set Outlook = CreateOutlook() Set Outlook = Nothing End Sub Function CreateOutlook() As Object Dim Outlook As Object On Error Resume Next Set Outlook = GetObject(, "Outlook.Application") On Error GoTo 0 If Outlook Is Nothing Then Shell "Outlook" On Error Resume Next Do While Outlook Is Nothing Set Outlook = GetObject(, "Outlook.Application") Loop On Error GoTo 0 Set Outlook = CreateObject("Outlook.Application") AppActivate Application.Caption 'This line doesn't cause an error but excel icon flashes in taskbar and doesn't activate. Set CreateOutlook = Outlook Set Outlook = Nothing End Function 

Ich habe Windows 7 Ultimate, 64-Bit.

0
Sie müssen Ihre Frage bearbeiten und angeben, welchen Fehler Sie erhalten haben. Ramhound vor 6 Jahren 0
Was passiert, wenn Sie stattdessen "AppActivate" Microsoft Outlook "" versuchen? duDE vor 6 Jahren 1
@duDE Warum sollte er Access aktivieren, wenn er in Excel arbeitet? LPChip vor 6 Jahren 0
Diese Zeile verursacht keinen Fehler, aber das Excel-Symbol blinkt in der Taskleiste und wird nicht aktiviert. Riccardo La Marca vor 6 Jahren 0
@LPChip Entschuldigung, ich dachte OP will Outlook aktivieren. Seine Frage ist nicht sehr detailliert :) duDE vor 6 Jahren 0
Ich habe die Frage zur Klarstellung bearbeitet. Riccardo La Marca vor 6 Jahren 0
Sie haben noch keine @duDE-Frage beantwortet. Bearbeiten Sie Ihre Frage. Ramhound vor 6 Jahren 0
Es kann funktionieren, wenn Sie versuchen, Ihr Arbeitsblatt zu aktivieren. Es ist schon eine Weile her, aber ich denke, der Code lautet: "ThisWorkbook.activesheet.activate" LPChip vor 6 Jahren 0
Funktioniert leider nicht. Riccardo La Marca vor 6 Jahren 0

1 Antwort auf die Frage

0
Riccardo La Marca

Gelöst!

Anstatt:

AppActivate Application.Caption 

Diese:

SendKeys "% i" 

Dann:

Option Explicit Sub Test() Dim Outlook As Object Set Outlook = CreateOutlook() Set Outlook = Nothing End Sub Function CreateOutlook() As Object Dim Minimize As Boolean Dim Outlook As Object Minimize = False On Error Resume Next Set Outlook = GetObject(, "Outlook.Application") On Error GoTo 0 If Outlook Is Nothing Then Shell "Outlook" Minimize = True End If On Error Resume Next Do While Outlook Is Nothing Set Outlook = GetObject(, "Outlook.Application") Loop On Error GoTo 0 If Minimize Then SendKeys "% i" Set Outlook = Nothing Set CreateOutlook = CreateObject("Outlook.Application") End Function