Waiting For List Box Selection in Vb

I have created the list box that displays the information I need to see. What I am looking to do is have the code wait for a selection to be made before continuing on. I can set up the list box with or without a button control. I have been trying to figure out what code will do this. Any code you know of?

Thanking You in Advance,
JerryB

Comments

  • : I have created the list box that displays the information I need to see. What I am looking to do is have the code wait for a selection to be made before continuing on. I can set up the list box with or without a button control. I have been trying to figure out what code will do this. Any code you know of?
    :
    : Thanking You in Advance,
    : JerryB
    :

    The Click-Event of the Listbox?

    Zvoni
    ------------------------------------------
    Only stupidity of mankind and the universe
    are infinite, but i'm not sure concerning
    the universe. A. Einstein

  • [b][red]This message was edited by JerryB at 2006-6-8 13:50:36[/red][/b][hr]
    : I have created the list box that displays the information I need to see. What I am looking to do is have the code wait for a selection to be made before continuing on. I can set up the list box with or without a button control. I have been trying to figure out what code will do this. Any code you know of?
    :
    : Thanking You in Advance,
    : JerryB
    :
    This is where I am at right now:
    Sub Selecttest1()
    '
    ActiveSheet.ListBoxes.Add(5, 15, 400, 400).Select
    Selection.Name = "ListBox1"
    ActiveSheet.ListBoxes(1).Select
    ActiveSheet.Buttons.Add(325, 117, 62.25, 27.75).Select
    Selection.Name = "Button 1"
    Selection.OnAction = "ListBoxes_Click2"
    Selection.ShapeRange.ScaleHeight 2.76, msoFalse, msoScaleFromBottomRight
    ActiveSheet.Shapes("Button 1").Select
    Selection.Characters.Text = "Select Item And Click Here "
    With Selection.Characters(Start:=1, Length:=27).Font
    .Name = "Arial"
    .FontStyle = "Regular"
    .Size = 10
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ColorIndex = 5
    End With
    g = "275 KwScan1"
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder("C:Smart Media Reader" + g)
    g = "": e = 1
    Set fc = f.SubFolders
    For Each f1 In fc
    g = f1.Name
    s = s & f1.Name
    s = s & vbCrLf
    ActiveSheet.ListBoxes(1).AddItem (g)
    e = e + 1
    Next
    g = ""
    ActiveSheet.ListBoxes(1).AddItem ("End Of List")
    Range("A1").Select
    10000 ActiveSheet.ListBoxes(1).Select
    10010 If (g = "") Then GoTo 10000
    Msg = "It came through."
    MsgBox Msg, vbCritical

    End Sub

    Sub ListBoxes_Click2()
    ActiveSheet.ListBoxes(1).Select
    Filename = ActiveSheet.ListBoxes(1).List(ActiveSheet.ListBoxes(1).ListIndex)
    g = Filename
    Windows("PERSONAL.XLS").Activate
    Range("A1").Select
    Application.Cells(1, 1) = g

    End Sub


    Thanks Again for any help
    JerryB
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