how to cutomize a message box?

First of all, thanks for looking at this.

I've developed a macro for use in ms word with VB. I want to have a message box pop up that asks the user where to save a quote, either to the local hard drive or a network (share) drive.
I would love a message box where two buttons say "Save to Local" and "Save to Share"

Any help is appreciated.


Comments

  • i don't know if that is possible. but the only way i see to get that done is for you to create your own user control. but it takes some programming time.

    the easiest way to do it is you create a new form with your prompt, then include two buttons with your own text, then assign values to each so that you can identify as to which button was clicked. you will have to show that form as DIALOG, so that your program will wait for that dialog box to finish before continuing to run the program.

    in vb.net, it is much easier since you can assign a vbOK, vbCancel values to buttons on your form, but i don't think it works on macros. i don't program much within macro. i hope this helps you in any way.


    : First of all, thanks for looking at this.
    :
    : I've developed a macro for use in ms word with VB. I want to have a message box pop up that asks the user where to save a quote, either to the local hard drive or a network (share) drive.
    : I would love a message box where two buttons say "Save to Local" and "Save to Share"
    :
    : Any help is appreciated.
    :
    :
    :

    [blue][size=4][b][italic]VCG[/italic][/b] :-D[/blue][/size]

  • Here is what you do to create a custom Message-Box:

    - Create A Form that will be the MessageBox.
    - Add buttons to that form and set their DialogResult

    ex.

    [code]
    Button1.DialogResult = DialogResult.OK
    Button2.DialogResult = DialogResult.Cancel
    [/code]

    Now you can call your MessageBox from another form like so ...

    (Assuming you named the MessageBox form "CustomMsgBox")
    [code]
    ...
    Dim mb as New CustomMsgBox

    Select Case mb.ShowDialog
    Case DialogResult.OK
    ' DO SOMETHING

    Case DialogResult.Cancel
    ' DO SOMETHING

    End Select

    [/code]

    Otherwise you can try a Win32 API approach:

    http://www.programmersheaven.com/c/MsgBoard/read.asp?Board=14&MsgID=196143&Setting=A9999F0001

    Note that the code at the link is VB6 but, should be able to be ported to VB.NET.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories