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

The technique recommended by your colleague is one way.

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

    ' 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:

Sub Main()
        ' 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
                Exit Do
            End If
        ' Otherwise, display a message and ask for the name again.
        crt.Dialog.MessageBox("Tab named '" & strTabName & "' was not found!")
End Sub

VanDyke Software
Technical Support
(505) 332-5730
Reply With Quote