VBA - Position a message box

Chris Davison (VBA)

Board Regular
Joined
Jun 22, 2002
Messages
84
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
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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.
 
Upvote 0
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).
 
Upvote 0
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....
 
Upvote 0
Yes you can. See:

http://groups.google.com/groups?q=e...m=399561F2.4E4FD652@csv.warwick.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
 
Upvote 0
On 2002-08-28 14:39, Ekim wrote:
Yes you can. See:

http://groups.google.com/groups?q=e...m=399561F2.4E4FD652@csv.warwick.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.
 
Upvote 0
Have you thought of using a "Shape" as a MsgBox? You can control the position of the shape.
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,316
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top