+ Reply to Thread
Results 1 to 3 of 3

VBA MsgBox focus

  1. #1
    Registered User
    Join Date
    04-13-2005
    Posts
    2

    VBA MsgBox focus

    Hi,

    I'm trying to write an Excel/VBA application that alerts a user with a pop-up box if an action has taken place.

    I'm using the VBA MsgBox function to do this, but unless the Excel application is in focus, the pop-up isn't in focus - the Excel icon on the task bar merely flashes, and the user has to click on this in order to see the message. I've tried the various MsgBox options (vbMsgBoxSetForeground, vbSystemModal, etc), but all to no avail.

    Does anyone know of an easy way to launch a pop-up from VBA - with or without using the MsgBox function - which assumes desktop focus?

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon Geoffgeoff (so good they named him twice...!)

    I'm assuming that you're trying to run Excel in the background and get the Msgbox to appear on the desktop when certain conditions are true?

    If that's what you are trying to do then I'm afraid you're out of luck. Excel's VBA is designed to work with the Office applications but not as a general windows programming tool - though there are enough generic commands to do some activities within Windows, and some others can be achieved with API calls, but I can find nothing that would do what you require. The msgbox's and userforms will only appear over an Office application's window.

    HTH

    DominicB

  3. #3
    Registered User
    Join Date
    04-13-2005
    Posts
    2
    Cheers Dominic,

    You saved me a lot of time. Looks like I'll need to call a Windows pop-up directly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1