Results 1 to 9 of 9

VBA - Position a message box

This is a discussion on VBA - Position a message box within the Excel Questions forums, part of the Question Forums category; Evening all, I have a bog-standard message box : Msgbox ("Continue") and it pops up in the middle of the ...

  1. #1
    Board Regular
    Join Date
    Jun 2002
    Location
    Millbank, London, UK
    Posts
    84

    Default

    Evening all,

    I have a bog-standard message box :


    Msgbox ("Continue")

    and it pops up in the middle of the screen, centred horizontally and centred vertically

    are we able to specify where it pops up ?

    Ideally, I'd like it bottom right of the screen, so it doesn't obscure the data on the sheet

    is this easy ?

    thanks
    Chris


    [ This Message was edited by: Chris Davison (VBA) on 2002-08-28 12:52 ]

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,947

    Default

    Mhmm... I believe there should be an API workaround, but, the standard MsgBox does not have a Left or Top propert or parameter that you can use... so, easy solution would be to create a Userform.
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    Board Regular
    Join Date
    Jun 2002
    Location
    Millbank, London, UK
    Posts
    84

    Default

    ahhhh, okie dokie, I'll forget it for the moment

    thanks JPG, much appreciated, as always


    Chris

  4. #4
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sunny, spring-like Hull
    Posts
    3,339

    Default

    I don't think you can do this with a MsgBox, but you can specify the position of an InputBox or, more usefully in your case, a custom UserForm (StartUpPosition property).

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,114

    Default

    Chris

    To add Userform you can locate as you like to any position, i have a feeling Msg popups you can to but im considering that one, from th eother posts il remember that for later, i have some examples if your intrested re userforms.

    Userforms are LUSH pop up are just that....
    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  6. #6
    Board Regular
    Join Date
    Jun 2002
    Location
    Perth, Australia
    Posts
    1,416

    Default

    Yes you can. See:

    http://groups.google.com/groups?q=ex....ac.uk&rnum=33

    About 100 lines of code in two modules - too much to post here (works great - using Excel 97-SR2).

    Some comments on this topic from a Google search:

    Is it possible to position a messagebox like a inputbox?

    A message box is a Windows-level feature, not Excel-only, and even when you 'hardcore'-produce a messagebox using the respective dll functions, you are not provided with an interface to position it.

    Unless by using Windows API calls, no.
    For one thing, your program is stopped while the message box is on the screen.

    Bill Manville
    MVP - Microsoft Excel, Oxford, England

    Regards,

    Mike


  7. #7
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,947

    Default

    Thanks Mike for the link. I knew it had to do with API calls, this is very similar to Ivan F Moala's timed MsgBox... very nice.
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  8. #8
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209

    Default

    On 2002-08-28 14:39, Ekim wrote:
    Yes you can. See:

    http://groups.google.com/groups?q=ex....ac.uk&rnum=33

    About 100 lines of code in two modules - too much to post here (works great - using Excel 97-SR2).

    Some comments on this topic from a Google search:

    Is it possible to position a messagebox like a inputbox?

    A message box is a Windows-level feature, not Excel-only, and even when you 'hardcore'-produce a messagebox using the respective dll functions, you are not provided with an interface to position it.

    Unless by using Windows API calls, no.
    For one thing, your program is stopped while the message box is on the screen.

    Bill Manville
    MVP - Microsoft Excel, Oxford, England

    Regards,

    Mike

    Yes it is long but thas because of the fact that excel97 doesn't have the Address of function.
    Kind Regards,
    Ivan F Moala From the City of Sails

  9. #9
    MrExcel MVP Joe Was's Avatar
    Join Date
    Feb 2002
    Location
    Central Florida, USA
    Posts
    7,539

    Default

    Have you thought of using a "Shape" as a MsgBox? You can control the position of the shape.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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


DMCA.com