Link to home
Create AccountLog in
Avatar of Svgmassive
Svgmassive

asked on

Custome message box button text

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
Avatar of Roy Cox
Roy Cox
Flag of United Kingdom of Great Britain and Northern Ireland image

How does if fail?

Run the macro UnitTest1 and it works.
Avatar of Svgmassive
Svgmassive

ASKER

it excel crashes at the at
    m_lProcHook = SetWindowsHookEx(WH_CBT, _
                                   AddressOf MsgBoxHookProc, _
                                   m_hInstance, _
                                   m_hThreadID)
What do you do just before the crash? I've displayed the mrssage box and clicked all the buttons with no crashing.
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.
this simplified version works.Lambert it allows you to change the button caption to what ever you wish.
msgbox.xlsb
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.
I've played around with the original example and changed Titles, etc. No crashing for me.
CustomMsgbox.xlsm
Roy it just doesn't work for me i don't know what to say
I'm using Office 365 ProPlus. It's 32bit but your API calls look as if they should work OK with 64bit.
i am using 2016 pro 64bit. it crashes everytime
Can you test on 32 bit. Where did you find this msgbox?
it works on 32bit no problem.
here's the link
http://shutupdean.com/blog/2014/08/01/vba-msgbox-custom-button-text/
ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Building on what Rory mention with a few modification.It's up and running in 64bit.
Thanks to everyone
CustomMsgboxFixed.xlsb
Haven't tried it in a 32 bit environment
Still works fine in 32 Bit