PDA

View Full Version : vba code to bring app to front



arathra
05-25-2010, 08:23 AM
I have snippet of code in Outlook which, at the click of a button, finds a specific record in Access and moves to it.

However, one small issue, can I add something so that Access comes to the front, i.e. the Access window appears on top of Outlook?

gypsyjoe11
06-28-2010, 07:57 AM
Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long

Public Sub test()
Set acObj = GetObject(, "Access.Application") 'get the currently open access program
SetForegroundWindow acObj.hWndAccessApp 'set it to be the active window
End Sub


hope this helps,

Joe