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
Windows 10Microsoft OfficeWindows OSMicrosoft Excel

Avatar of undefined
Last Comment
Roy Cox

8/22/2022 - Mon
Roy Cox

How does if fail?

Run the macro UnitTest1 and it works.
Svgmassive

ASKER
it excel crashes at the at
    m_lProcHook = SetWindowsHookEx(WH_CBT, _
                                   AddressOf MsgBoxHookProc, _
                                   m_hInstance, _
                                   m_hThreadID)
Roy Cox

What do you do just before the crash? I've displayed the mrssage box and clicked all the buttons with no crashing.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Fabrice Lambert

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.
Svgmassive

ASKER
this simplified version works.Lambert it allows you to change the button caption to what ever you wish.
msgbox.xlsb
Fabrice Lambert

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.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Roy Cox

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

ASKER
Roy it just doesn't work for me i don't know what to say
Roy Cox

I'm using Office 365 ProPlus. It's 32bit but your API calls look as if they should work OK with 64bit.
Your help has saved me hundreds of hours of internet surfing.
fblack61
Svgmassive

ASKER
i am using 2016 pro 64bit. it crashes everytime
Roy Cox

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

ASKER
it works on 32bit no problem.
here's the link
http://shutupdean.com/blog/2014/08/01/vba-msgbox-custom-button-text/
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Rory Archibald

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Svgmassive

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

ASKER
Haven't tried it in a 32 bit environment
Roy Cox

Still works fine in 32 Bit
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck