locked
msgbox with radio buttons RRS feed

  • Question

  • is it  possible to have 3 radio buttons in a msgbox. its purpose is to select a directory and put the link in a variable. So, one would select a button then click ok. This would assign the variable with the string of the directory path.

    Jim Neely

    Thursday, January 10, 2013 2:43 AM

Answers

  • No, the VBA MsgBox doesn't know Radio Buttons. You will have to use a different approach. You can for example do it with an Imputbox:

    Public Function FolderChooser() As String
     Dim s As String
     s = InputBox("Please select what you want to do" & _
             vbCrLf & vbTab & "1 - Select this one" & _
             vbCrLf & vbTab & "2 - Select this one here" & _
             vbCrLf & vbTab & "3 - select the 3rd option", "Option Chooser")
     Select Case s
         Case "1"
             FolderChooser = "C:\Folder1"
         Case "2"
             FolderChooser = "C:\Folder1"
         Case "3"
             FolderChooser = "C:\Folder1"
         Case Else
             FolderChooser = "*nothing selected*"
     End Select
    End Function

    When you call this function, it will display 3 options. The user then has to enter 1, 2 or 3 and as result the function returns the corresponding folder.
    You may test it in the immediate window in the VBA IDE

    HTH
    Henry

    Henry

    "STARFALLS" schrieb im Newsbeitrag news:f11dad84-b3e3-4e8e-8482-612464f65cce@communitybridge.codeplex.com...

    is it  possible to have 3 radio buttons in a msgbox. its purpose is to
    select a directory and put the link in a variable. So, one would select
    a button then click ok. This would assign the variable with the string
    of the directory path.


    Jim Neely

    • Proposed as answer by Henry Habermacher Thursday, January 10, 2013 7:46 AM
    • Marked as answer by STARFALLS Friday, January 11, 2013 12:31 AM
    Thursday, January 10, 2013 4:41 AM
  • This does what I want Good Job. Now how and I use the result/variable in my called program? I am using call from my program and it pulls up the screen, I enter a choice and it steps to the next line but then loops back to the function.


    Jim Neely

    it should read "Now how can I" not "Now how and I" sorry for the typo

    NEVER MIND!!!!! I had it programed wrong, it works great! Thanks so much

    • Edited by STARFALLS Thursday, January 10, 2013 5:52 AM
    • Marked as answer by STARFALLS Thursday, January 10, 2013 5:52 AM
    Thursday, January 10, 2013 5:44 AM
  • You mean my posting helped you? If so, then you should mark my posting as answer to your question and not your answer to my posting, just to help the next ones to find the answer easier without reading the whole thread.

    Thanks

    Henry

    • Marked as answer by STARFALLS Saturday, January 12, 2013 11:52 PM
    Thursday, January 10, 2013 7:45 AM
  • Hi Starfalls,

    You can create a custom dialog box to present the 3 radio button


    Nasir Akhtar

    • Marked as answer by STARFALLS Saturday, January 12, 2013 11:52 PM
    Friday, January 11, 2013 6:25 PM

All replies

  • No, the VBA MsgBox doesn't know Radio Buttons. You will have to use a different approach. You can for example do it with an Imputbox:

    Public Function FolderChooser() As String
     Dim s As String
     s = InputBox("Please select what you want to do" & _
             vbCrLf & vbTab & "1 - Select this one" & _
             vbCrLf & vbTab & "2 - Select this one here" & _
             vbCrLf & vbTab & "3 - select the 3rd option", "Option Chooser")
     Select Case s
         Case "1"
             FolderChooser = "C:\Folder1"
         Case "2"
             FolderChooser = "C:\Folder1"
         Case "3"
             FolderChooser = "C:\Folder1"
         Case Else
             FolderChooser = "*nothing selected*"
     End Select
    End Function

    When you call this function, it will display 3 options. The user then has to enter 1, 2 or 3 and as result the function returns the corresponding folder.
    You may test it in the immediate window in the VBA IDE

    HTH
    Henry

    Henry

    "STARFALLS" schrieb im Newsbeitrag news:f11dad84-b3e3-4e8e-8482-612464f65cce@communitybridge.codeplex.com...

    is it  possible to have 3 radio buttons in a msgbox. its purpose is to
    select a directory and put the link in a variable. So, one would select
    a button then click ok. This would assign the variable with the string
    of the directory path.


    Jim Neely

    • Proposed as answer by Henry Habermacher Thursday, January 10, 2013 7:46 AM
    • Marked as answer by STARFALLS Friday, January 11, 2013 12:31 AM
    Thursday, January 10, 2013 4:41 AM
  • This does what I want Good Job. Now how and I use the result/variable in my called program? I am using call from my program and it pulls up the screen, I enter a choice and it steps to the next line but then loops back to the function.


    Jim Neely

    it should read "Now how can I" not "Now how and I" sorry for the typo

    NEVER MIND!!!!! I had it programed wrong, it works great! Thanks so much

    • Edited by STARFALLS Thursday, January 10, 2013 5:52 AM
    • Marked as answer by STARFALLS Thursday, January 10, 2013 5:52 AM
    Thursday, January 10, 2013 5:44 AM
  • You mean my posting helped you? If so, then you should mark my posting as answer to your question and not your answer to my posting, just to help the next ones to find the answer easier without reading the whole thread.

    Thanks

    Henry

    • Marked as answer by STARFALLS Saturday, January 12, 2013 11:52 PM
    Thursday, January 10, 2013 7:45 AM
  • did it Thanks you !!!!

    Jim Neely

    Friday, January 11, 2013 12:31 AM
  • Hi Starfalls,

    You can create a custom dialog box to present the 3 radio button


    Nasir Akhtar

    • Marked as answer by STARFALLS Saturday, January 12, 2013 11:52 PM
    Friday, January 11, 2013 6:25 PM