Solved

Using Tab

Posted on 2009-03-31
4
210 Views
Last Modified: 2012-05-06
I'm using sstab which composed 8 tabs.  i used command button to move and back the desired tab. How to move and back the tab by using command button?
Private Sub Next_Click()
eTab.Tab = 0 + 1 ' how to move to tab 2,3,4,5,6,7, and 8
End Sub
 
Private Sub Back_Click()
eTab.Tab 'how to back the previous tab from the current tab
End Sub

Open in new window

0
Comment
Question by:Whing Dela Cruz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 24030244
something like this:
Private Sub Back_Click()
    If eTab.TabIndex > 0 Then
        eTab.TabIndex = eTab.TabIndex - 1
        eTab.TabVisible(eTab.TabIndex) = True
        eTab.Tab = eTab.TabIndex
    End If
End Sub
 
Private Sub Next_Click()
    If eTab.TabIndex < eTab.Tabs - 1 Then
        eTab.TabIndex = eTab.TabIndex + 1
        eTab.TabVisible(eTab.TabIndex) = True
        eTab.Tab = eTab.TabIndex
    End If
End Sub

Open in new window

0
 
LVL 16

Accepted Solution

by:
Robin earned 250 total points
ID: 24030279
How about this? :
Private Sub Next_Click()
    Dim iTab As Integer
    
    iTab = eTab.Tab
    iTab = iTab + 1
    If iTab > 7 Then
        iTab = 0
    End If
    eTab.Tab = iTab
End Sub
 
Private Sub Back_Click()
    Dim iTab As Integer
    
    iTab = eTab.Tab
    iTab = iTab - 1
    If iTab < 0 Then
        iTab = 7
    End If
    eTab.Tab = iTab
End Sub

Open in new window

0
 
LVL 51

Assisted Solution

by:Ryan Chong
Ryan Chong earned 250 total points
ID: 24030404
sorry, try this instead:

Private Sub Back_Click()
    If eTab.Tab > 0 Then
        eTab.Tab = eTab.Tab - 1
    End If
End Sub

Private Sub Next_Click()
    If eTab.Tab < eTab.Tabs - 1 Then
        eTab.Tab = eTab.Tab + 1
    End If
End Sub
0
 

Author Closing Comment

by:Whing Dela Cruz
ID: 31564888
Thanks to you guys!
All Code is working..
thanks! And more power to you!
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question