[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

Change Msgbox Button Text

Hello experts, rookie here.
I use msgboxs throughout my app. and the defaults are normally fine. I have one were instead of saying "Yes" "No", I would like to say "Now" "Later". This is my standard setup for a msgbox.

Dim Cancel As Integer
Dim strMessage, Title As String
Dim intOptions As Integer
Dim bytChoice As Byte
           
strMessage = "Do it Now or Later?"
Title = "Process Assignments"
intOptions = vbQuestion + vbYesNo + vbDefaultButton2
bytChoice = MsgBox(strMessage, intOptions, Title)
           
     If bytChoice = vbNo Then
          Cancel = True  
                Else
                     'Do the function

Is there a fairly easy way to do this? I keep finding very large/complex msgbox threads were you can change button location and everything else. Unfortunately I can not seem to get thru the mountains of code to find the parts that would just let me do this.

Thanks
Jim
0
JimK31
Asked:
JimK31
3 Solutions
 
Rey Obrero (Capricorn1)Commented:
You can not change the default msgbox.
If you want a customize one, you have to create your own  form and make it look like a msgbox
0
 
harfangCommented:
Point is: you can, but only using rather complex system-level WinAPI calls. It is not worth the trouble.
Follow capricorn's advice: it's easier and more fun that way!
cheers:)
0
 
harfangCommented:
BTW: if you need advice on how to create the form, feel free to ask ;)
0
 
Ryan ChongCommented:
Worth to try below? Which method is faster? 8-)

Try customize this:

Modifying a Message Box with SetWindowsHookEx
http://vbnet.mvps.org/code/hooks/messageboxhook.htm

Hope this helps
0
 
JimK31Author Commented:
Thanks everyone. Not what I wanted to hear, but at least I know I wasn't missing something. I have long since gotten away from form messages as I don't really like them, but in this case since it is only one, it looks like the best choice. The messagebox hook stuff I have read before and is just beyond my ability to hack. Or maybe better said, just to much code for so little a change. I'm splitting the points for the effort.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now