+ Reply to Thread
Results 1 to 6 of 6

Auto move scroll bars of listbox

  1. #1
    JON JON
    Guest

    Auto move scroll bars of listbox

    Dear Ng,

    I had created a user form which is not modal that serves as splash screen
    while my macro runs into the background. This userform includes a listbox
    that is populated during runtime. My problem now is that when the entries
    in the listbox exceed beyond it size, the latest entries are being hide in
    view. Is there a way that I can move the scroll bars of the listbox so that
    I can show the latest entries in view.

    All help will be highly appreciated.

    Regards,

    Jon-jon





  2. #2
    Tom Ogilvy
    Guest

    Re: Auto move scroll bars of listbox

    Look at the topIndex property of the Listbox.

    --
    Regards,
    Tom Ogilvy

    "JON JON" <[email protected]> wrote in message
    news:[email protected]...
    > Dear Ng,
    >
    > I had created a user form which is not modal that serves as splash screen
    > while my macro runs into the background. This userform includes a

    listbox
    > that is populated during runtime. My problem now is that when the

    entries
    > in the listbox exceed beyond it size, the latest entries are being hide

    in
    > view. Is there a way that I can move the scroll bars of the listbox so

    that
    > I can show the latest entries in view.
    >
    > All help will be highly appreciated.
    >
    > Regards,
    >
    > Jon-jon
    >
    >
    >
    >




  3. #3
    keepITcool
    Guest

    Re: Auto move scroll bars of listbox

    topindex demo...

    Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

    Private Sub UserForm_activate()
    Dim i%
    With ListBox1
    For i = 1 To 100
    .AddItem "item" & Format(i, " 000")
    If .ListCount > 5 Then
    .TopIndex = .ListCount - 5
    End If
    Me.Repaint
    Sleep 100
    Next
    End With
    Unload Me
    End Sub

    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam


    Tom Ogilvy wrote :

    > Look at the topIndex property of the Listbox.


  4. #4
    JON JON
    Guest

    Re: Auto move scroll bars of listbox

    Keep ITcool,

    Thank you very much it was a great help.

    Can you please extend more help by explaining what does the "Sleep 100" do?
    I am just really curious about it.

    TIA,

    Jon-jon



    "keepITcool" <[email protected]> wrote in message
    news:[email protected]...
    > topindex demo...
    >
    > Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    >
    > Private Sub UserForm_activate()
    > Dim i%
    > With ListBox1
    > For i = 1 To 100
    > .AddItem "item" & Format(i, " 000")
    > If .ListCount > 5 Then
    > .TopIndex = .ListCount - 5
    > End If
    > Me.Repaint
    > Sleep 100
    > Next
    > End With
    > Unload Me
    > End Sub
    >
    > --
    > keepITcool
    > | www.XLsupport.com | keepITcool chello nl | amsterdam
    >
    >
    > Tom Ogilvy wrote :
    >
    >> Look at the topIndex property of the Listbox.




  5. #5
    keepITcool
    Guest

    Re: Auto move scroll bars of listbox

    Jon, jon

    similar as application.wait the Sleep function suspends the execution
    of the current thread for a specified interval. This is a so called
    windows API call.

    the sleep is just for the demo to keep the loop slow enough to see it
    move...



    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam


    JON JON wrote :

    > Keep ITcool,
    >
    > Thank you very much it was a great help.
    >
    > Can you please extend more help by explaining what does the "Sleep
    > 100" do? I am just really curious about it.
    >
    > TIA,
    >
    > Jon-jon
    >
    >
    >
    > "keepITcool" <[email protected]> wrote in message
    > news:[email protected]...
    > > topindex demo...
    > >
    > > Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    > >
    > > Private Sub UserForm_activate()
    > > Dim i%
    > > With ListBox1
    > > For i = 1 To 100
    > > .AddItem "item" & Format(i, " 000")
    > > If .ListCount > 5 Then
    > > .TopIndex = .ListCount - 5
    > > End If
    > > Me.Repaint
    > > Sleep 100
    > > Next
    > > End With
    > > Unload Me
    > > End Sub
    > >
    > > --
    > > keepITcool
    > > > www.XLsupport.com | keepITcool chello nl | amsterdam

    > >
    > >
    > > Tom Ogilvy wrote :
    > >
    > >> Look at the topIndex property of the Listbox.


  6. #6
    JON JON
    Guest

    Re: Auto move scroll bars of listbox

    Again, thank you very much


    "keepITcool" <[email protected]> wrote in message
    news:[email protected]...
    > Jon, jon
    >
    > similar as application.wait the Sleep function suspends the execution
    > of the current thread for a specified interval. This is a so called
    > windows API call.
    >
    > the sleep is just for the demo to keep the loop slow enough to see it
    > move...
    >
    >
    >
    > --
    > keepITcool
    > | www.XLsupport.com | keepITcool chello nl | amsterdam
    >
    >
    > JON JON wrote :
    >
    >> Keep ITcool,
    >>
    >> Thank you very much it was a great help.
    >>
    >> Can you please extend more help by explaining what does the "Sleep
    >> 100" do? I am just really curious about it.
    >>
    >> TIA,
    >>
    >> Jon-jon
    >>
    >>
    >>
    >> "keepITcool" <[email protected]> wrote in message
    >> news:[email protected]...
    >> > topindex demo...
    >> >
    >> > Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    >> >
    >> > Private Sub UserForm_activate()
    >> > Dim i%
    >> > With ListBox1
    >> > For i = 1 To 100
    >> > .AddItem "item" & Format(i, " 000")
    >> > If .ListCount > 5 Then
    >> > .TopIndex = .ListCount - 5
    >> > End If
    >> > Me.Repaint
    >> > Sleep 100
    >> > Next
    >> > End With
    >> > Unload Me
    >> > End Sub
    >> >
    >> > --
    >> > keepITcool
    >> > > www.XLsupport.com | keepITcool chello nl | amsterdam
    >> >
    >> >
    >> > Tom Ogilvy wrote :
    >> >
    >> >> Look at the topIndex property of the Listbox.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1