View Single Post
  #2  
Old 07-11-2016, 09:32 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,448
Hi Rhudi,

The technique recommended by your colleague is one way.

Many of our example scripts illustrate "tab-safe" best practices, such as:

Code:
    ' Make this script tab safe
    Dim objTab
    objTab = crt.GetScriptTab
However, in your case, since you are working with multiple tabs, you also might want to prompt to be sure the correct tab is active:

Code:
Sub Main()
    Do
        ' Ask which tab to activate, by name/title/caption
        strTabName = crt.Dialog.Prompt("What is the name of the tab you would like to activate?", "Which tab?", strTabName)
        If strTabName = "" Then Exit Do
        
        ' Iterate through all tabs, searching for a match on the name"
        For i = 1 To crt.GetTabCount
            Set objTab = crt.GetTab(i)
            If objTab.Caption = strTabName Then
                objTab.Activate
                Exit Do
            End If
        Next
        
        ' Otherwise, display a message and ask for the name again.
        crt.Dialog.MessageBox("Tab named '" & strTabName & "' was not found!")
    Loop
End Sub
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote