Excel VBA Windows API: SetForegroundWindow is not working when another application is being maximized by ShowWindow SW_MAXMIZE -
i want maximize ie sw_maxmize , alert user prompting msgbox. since ie maxmized, want bring excel top calling setforegroundwindow, statement not working. please help!
my code:
public declare ptrsafe function apishowwindow lib "user32" alias "showwindow" (byval hwnd long, byval ncmdshow long) long public declare ptrsafe function setforegroundwindow lib "user32" (byval hwnd longptr) long public const sw_maximize = 3 sub try() set ie = new internetexplorermedium ie.visible = true apishowwindow ie.hwnd, sw_maximize setforegroundwindow application.hwnd 'not working msgbox "ie opened" setforegroundwindow ie.hwnd end sub
Comments
Post a Comment