Results 1 to 9 of 9
  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Quick and dirty option array.

    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.

  2. #2
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Quick and dirty option array.

    Although some VBA gurus read here, you might have better luck posting on the VBA forum.
    Charles Kyle Kenyon
    Madison, Wisconsin

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Quick and dirty option array.

    Charles,

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

    I suspect not many of us fit that category.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Quick and dirty option array.

    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
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Quick and dirty option array.

    Speaking for myself, I think "Word macro wonk" is a closer fit![img]/w3timages/icons/grin.gif[/img]

  6. #6
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Quick and dirty option array.

    What about VBA Hack?

    (and I'm speaking for myself)
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  7. #7
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Quick and dirty option array.

    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

  8. #8
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Quick and dirty option array.

    "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.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  9. #9
    4 Star Lounger
    Join Date
    May 2003
    Location
    Austin
    Posts
    401
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Quick and dirty option array.

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •