• Quick and dirty option array.

    Author
    Topic
    #352777

    I have a form with 6 objects in it. There are also 6 radio boxes. I need to create an array that takes the selected object and brings up the appropriate form for the selection.
    The objects (pictures) obviously have nothing to do with it other than a guide for me.

    Example:
    Selecting radio box 1-Which is located under img1-brings up UserForm10 (Since UserForms 1-4 are already used and referred to in the other macros).
    Inside UserForm 10 there is a series of fields (textboxes) that the customer fills out.

    From there I need to harvest the data from those fields and save to some type of delimited text file, but that’s later on. In JavaScript this part is relatively easy, I hope it’s the same here.

    Viewing 1 reply thread
    Author
    Replies
    • #514170

      Although some VBA gurus read here, you might have better luck posting on the VBA forum.

      • #514176

        Charles,

        “guru: a personal religious teacher and spiritual guide in Hinduism” (Miriam Webster).

        I suspect not many of us fit that category.

    • #514177

      Hi,

      Is what you want something like a click event on each radio button- eg:

      Private Sub OptionButton1_Click()
      UserForm10.Show
      End Sub

      Then in Userform10, have an “OK” button (cmdOK) with code something like:

      Private Sub cmdOK_Click()
      Dim strText As String
      Dim iFileno As Integer
      strText = TextBox1.Value & vbCrLf & TextBox2.Value & vbCrLf & TextBox3.Value
      iFileno = FreeFile

      Open “c:temp.txt” For Output As iFileno
      Print #iFileno, strText
      Close #iFileno
      End Sub

      • #514374

        Yeah, Something very close to that. Thanks
        What was the ifileno = Freefile?

        Open “c:temp.txt” For Output As iFileno
        Print #iFileno, strText
        Close #iFileno
        End Sub

        You guys may not be gurus, but perhaps ‘sages’ would be more applicable.
        ‘Sage’-one (as a profound philosopher or eminently wise councelor) distinguished for wisdom-Mirriam Webster.

        S-S-S-S-Sages

        • #514404

          “iFileNo = Freefile”

          You might just have written:
          Open “c:temp.txt” For Output As 1
          Print 1, strText
          Close 1
          End Sub

          But you might have had trouble if you copied this code into another project in which file #1 was already open.

          So “iFileno=FreeFile” just means- “Get me a number for a file which is not already open”. I could then copy this into a project with 20 files already open, and know that I could use it safely.

      • #514407

        Yes to all.
        The option array takes care of itself.
        The cmdOK button is also good.
        How could I give the user the option to ‘save as’?
        Thanks for ALL of you assistance, Geoff.

    Viewing 1 reply thread
    Reply To: Quick and dirty option array.

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: