Consulting

Results 1 to 2 of 2

Thread: vba code to bring app to front

  1. #1

    vba code to bring app to front

    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?

  2. #2

    This should work

     
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •