We help IT Professionals succeed at work.

Custome message box button text

206 Views
Last Modified: 2018-12-17
I am trying to implement the attached file i founs elsewhere It crashes on windows 10 64bit and office 2016 64bit.I need the experts
CustomMsgbox.xlsm
Comment
Watch Question

Roy CoxGroup Finance Manager
CERTIFIED EXPERT

Commented:
How does if fail?

Run the macro UnitTest1 and it works.

Author

Commented:
it excel crashes at the at
    m_lProcHook = SetWindowsHookEx(WH_CBT, _
                                   AddressOf MsgBoxHookProc, _
                                   m_hInstance, _
                                   m_hThreadID)
Roy CoxGroup Finance Manager
CERTIFIED EXPERT

Commented:
What do you do just before the crash? I've displayed the mrssage box and clicked all the buttons with no crashing.
Fabrice LambertConsulting
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
Experiencing crash here as well (Office 64).

What's this is supposed to do ?

Side note:
Give up hungarian notation, it provides nothing usefull, only make the code tougher to read.

Author

Commented:
this simplified version works.Lambert it allows you to change the button caption to what ever you wish.
msgbox.xlsb
Fabrice LambertConsulting
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
Well …….

Better write a custom form, and use it as a dialog box.
It will be easyer to undesrstand and more stable than messing up with APIs.

Side note:
I don't think doing correspondance between custom and VBA constants is a wise idea. They do not have the same meaning.
Roy CoxGroup Finance Manager
CERTIFIED EXPERT

Commented:
I've played around with the original example and changed Titles, etc. No crashing for me.
CustomMsgbox.xlsm

Author

Commented:
Roy it just doesn't work for me i don't know what to say
Roy CoxGroup Finance Manager
CERTIFIED EXPERT

Commented:
I'm using Office 365 ProPlus. It's 32bit but your API calls look as if they should work OK with 64bit.

Author

Commented:
i am using 2016 pro 64bit. it crashes everytime
Roy CoxGroup Finance Manager
CERTIFIED EXPERT

Commented:
Can you test on 32 bit. Where did you find this msgbox?

Author

Commented:
it works on 32bit no problem.
here's the link
http://shutupdean.com/blog/2014/08/01/vba-msgbox-custom-button-text/
Grand Poobah
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2011
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Building on what Rory mention with a few modification.It's up and running in 64bit.
Thanks to everyone
CustomMsgboxFixed.xlsb

Author

Commented:
Haven't tried it in a 32 bit environment
Roy CoxGroup Finance Manager
CERTIFIED EXPERT

Commented:
Still works fine in 32 Bit
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.