How to ge MsgBoxes to appear in the centre of a UserForm

Using Window 7 Home (64bit) - Excel 365.

I have an application that is run from a UserForm - is there some way that I can get MsgBoxes to appear in the centre of the UserForm?

Thanks,
Roy
RzzBAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Try this little demo.
28853719.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Zac HarrisSystems Administrator Commented:
You can use this code to position the box in the user form. You may have to tweak the numbers of course for your form...

With UserForm1
    .StartUpPosition = 0
    .Top = 100
    .Left = 25
    .Show
End With

Open in new window

0
RzzBAuthor Commented:
Brilliant - Works a treat.
Many thanks.
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest youincluding these two new ones.
An Experts Exchange Shortcut for the Truly Lazy (for Apple OS X)
A Guide to Writing Understandable and Maintainable VBA Code
Marty - MVP 2009 to 2015, Experts-Exchange Top Expert Visual Basic Classic 2012 to 2014
0
RzzBAuthor Commented:
Ooopsss - Spoke too soon - slight problem.

It works fine with the first Message box that is opened - opened perfectly in the centre of my UsreForm.

After this, further invocations of MsgboxEX, go to the top left of the monitor.

I must be doing something wrong?

Thoughts?
Roy
0
Martin LissOlder than dirtCommented:
Do you have a project that you can zip up and attach and also describe the steps that resulted in the problem?
0
RzzBAuthor Commented:
OK, after much hair pulling, this seems to be associated with the fact that I'm running my application without any worksheets visible. For how/why see this thread...

Complications - Interactions with other WorkBooks

The attached is a small demo of the strange behaviour. It works fine with the application hidden on the first invocation - but on subsequent invocations the message box appears at the top right. This is on my single monitor set up.

On my multi screen set up it hangs on the second invocation.

Thanks for your help,
Roy
MsgboxExTest.xlsm
0
Martin LissOlder than dirtCommented:
Please describe step by step what to do to reproduce the problem because I don't seem to be able to reproduce it via Excel 2010.
0
RzzBAuthor Commented:
Here is a small video, on dropbox, showing what's going on.

BTW - When you run this test don't have any other excel workbooks running.
0
RzzBAuthor Commented:
One further thing I have just found is that if you don't move the userform after you open it, then it goes to the TopLeft on first invocation.
0
RzzBAuthor Commented:
One further thing I have just found is that if you don't move the userform after you open it, then it goes to the TopLeft on first invocation.

Hmmm - on further investigation - only sometimes ....
0
Martin LissOlder than dirtCommented:
Sorry but I still can't reproduce the problem and you might want to post a new question to get more attention. If you do you should note the the link you posted to your dropbox is missing the required colon following https.
0
RzzBAuthor Commented:
Opps yes - the link should be...

https://www.dropbox.com/sh/6d58e8bakvtm70r/AABrhO_CnzsxfXK4_ltb0aVpa?dl=0

OK - Perhaps it's a 365 problem?

So do I do a completely new post, or do I somehow do it in this post but not as a comment?
0
Martin LissOlder than dirtCommented:
I would open a new question explaining the problem, refer to this question and include the video.
0
RzzBAuthor Commented:
Just for clarity - did you run the test workbook that I posted - and it worked correctly when using Excel 2010 - what Windows version are you using?
0
Martin LissOlder than dirtCommented:
I used your test file in Excel 2010 in Windows XP running as a VM on an iMac (not exactly typical), and yes as far as I can tell it works correctly.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.