Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

While/wend problem 4

Status
Not open for further replies.
Nov 7, 2002
61
US
Hi,

I've written the below code to write data from an Excel spreadsheet to a WRQ Reflections terminal. It was working fine until I tried to add a loop to it. If I use "While", it says "Wend without while". If I try to use a "For" loop, it says "Loop without For".

Any ideas?

Thanks.

Code:
Private Sub CommandButton1_Click()
    On Error GoTo ErrorHandler
    'Extra Objects
    'Dim ExScreen As Object
    'Set ExScreen = System.ActiveSession.Screen
    
    Const NEVER_TIME_OUT = 0
    Dim appExcel As Object
    Dim wbExcel As Object
    Dim aSheet As Object
    Dim CR As String
    Dim ESC As String   ' Chr(rcESC) = Chr(27) = Control-[
    Dim x As Integer
    
    
    Set appExcel = CreateObject("Excel.Application")
    Set wbExcel = appExcel.WorkBooks.Open("C:/Test3.xls")
    Set aSheet = wbExcel.Sheets("Sheet1")
    '.TransmitTerminalKey rcVtEnterKey
    CR = Chr(Reflection2.ControlCodes.rcCR)
    ESC = Chr(Reflection2.ControlCodes.rcESC)
    x = 1
    
While aSheet.UsedRange.Rows.Count <> 13954
    With Session
        .Transmit "E"
        'pause
        .StatusBar = "Waiting for Prompt: NAME: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1

        .StatusBar = "Waiting for Prompt: NUMERIC CODE: ("
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        
        .StatusBar = "Waiting for Prompt: MNEMONIC: ("
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1

        If aSheet.Cells(x, 2).Text <> "UPIN NUMBER:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: UPIN NUMBER: ("
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "AKA NAME:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: AKA NAME: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        ' Press VtEnter (Simulate pressing the Enter key).
        .TransmitTerminalKey rcVtEnterKey
        End If

        If aSheet.Cells(x, 2).Text <> "HIPAA Provider ID:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HIPAA Provider ID: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        ' Press VtEnter (Simulate pressing the Enter key).
        .TransmitTerminalKey rcVtEnterKey
        End If

        If aSheet.Cells(x, 2).Text <> "RPO and POL Username:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: RPO and POL Username: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        ' Press VtEnter (Simulate pressing the Enter key).
        .TransmitTerminalKey rcVtEnterKey
        End If
        
        If aSheet.Cells(x, 2).Text <> "SZ_NUMBER:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: SZ_NUMBER: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        ' Press VtEnter (Simulate pressing the Enter key).
        .TransmitTerminalKey rcVtEnterKey
        End If
        
        If aSheet.Cells(x, 2).Text <> "CLINICIAN TYPE:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: CLINICIAN TYPE: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        .StatusBar = "Waiting for Prompt: Taxonomy Code Effective Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        ' Press VtEnter (Simulate pressing the Enter key).
        .TransmitTerminalKey rcVtEnterKey
        
        If aSheet.Cells(x, 2).Text <> "Specialty:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Specialty: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: Site: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        ' Press VtEnter (Simulate pressing the Enter key).
        .TransmitTerminalKey rcVtEnterKey

        .StatusBar = "Waiting for Prompt: Taxonomy Code: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        ' Press VtEnter (Simulate pressing the Enter key).
        .TransmitTerminalKey rcVtEnterKey

        .StatusBar = "Waiting for Prompt: Federal Tax ID: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        ' Press VtEnter (Simulate pressing the Enter key).
        .TransmitTerminalKey rcVtEnterKey
        
        If aSheet.Cells(x, 2).Text <> "DIVISION:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: DIVISION: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit 301
        .Transmit CR
        End If
        
        While .StatusBar = "Waiting for Prompt: BILLING AREA(S): {"
        .StatusBar = "Waiting for Prompt: BILLING AREA(S): {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        Wend
        
        

        .StatusBar = "Waiting for Prompt: Sched Department for this provider: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
            
        While .StatusBar = "Waiting for Prompt: LOCATION(S): {"
        .StatusBar = "Waiting for Prompt: LOCATION(S): {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        Wend
        
        If aSheet.Cells(x, 2).Text <> "Group Profile for Sched Provider:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Group Profile for Sched Provider: {"
        .WaitForString ESC & "[31D", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit "PA" & CR
        End If
        
        .StatusBar = "Waiting for Prompt: Is this the entry?"
        .WaitForString ESC & "[0m ", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit "1" & CR

        If aSheet.Cells(x, 2).Text <> "FIRST LINE STREET ADDRESS:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: FIRST LINE STREET ADDRESS: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        .StatusBar = "Waiting for Prompt: SECOND LINE STREET ADDRESS: {"
        '.StatusBar = "Waiting for Prompt: SECOND LINE STREET ADDRESS: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "CITY,STATE ZIP:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: CITY,STATE ZIP: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        .StatusBar = "Waiting for Prompt: Zip Code for Child Dictionaries: {"
        '.WaitForString "5;74H}" & ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: TELEPHONE #: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "UPIN NUMBER (Custom Location 4103):" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: UPIN NUMBER (Custom Location 4103): {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "NPI number:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: NPI number: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "INDIVIDUAL BLUE SHIELD ID #:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: INDIVIDUAL BLUE SHIELD ID #: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "BLUE SHIELD BILLING CODE:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: BLUE SHIELD BILLING CODE: {"
        .WaitForString "0;74H}" & ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "BLUE SHIELD TAPE BILLING CODE:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: BLUE SHIELD TAPE BILLING CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        End If
        
        If aSheet.Cells(x, 2).Text <> "Individual Medicaid Id #:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Individual Medicaid Id #: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        If aSheet.Cells(x, 2).Text <> "Medicaid Billing Code:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Medicaid Billing Code: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        If aSheet.Cells(x, 2).Text <> "Medicaid Tape Billing Code:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Medicaid Tape Billing Code: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "INDIVIDUAL MEDICARE ID #:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: INDIVIDUAL MEDICARE ID #: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        If aSheet.Cells(x, 2).Text <> "MEDICARE BILLING CODE:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: MEDICARE BILLING CODE: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        .StatusBar = "Waiting for Prompt: MEDICARE TAPE BILLING CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        If aSheet.Cells(x, 2).Text <> "STATE LICENSE NO.:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: STATE LICENSE NO.: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "SOCIAL SECURITY NUMBER:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: SOCIAL SECURITY NUMBER: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: BCRR PROVIDER TYPE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "INDIVIDUAL RAILROAD MEDICARE#:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: INDIVIDUAL RAILROAD MEDICARE#: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: ACCEPT BS ASSIGNMENT?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "ACCEPT MEDICARE ASSIGNMENT?:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: ACCEPT MEDICARE ASSIGNMENT?: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: ACCEPT COMMERCIAL ASSIGNMENT?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: CHAMPUS BILLING CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: CHAMPUS BOX NUMBER: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "VALID GROUP(S):" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: VALID GROUP(S): {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "ALLOW AS PCP IN HMO(S):" Then
            .Transmit CR
        Else
        While .StatusBar = "Waiting for Prompt: ALLOW AS PCP IN HMO(S): {"
        .StatusBar = "Waiting for Prompt: ALLOW AS PCP IN HMO(S): {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1

        Wend
        
        
        
        If aSheet.Cells(x, 2).Text <> "ALLOW AS REFERRED TO PROV IN HMO(S):" Then
            .Transmit CR
        Else
        While .StatusBar = "Waiting for Prompt: ALLOW AS REFERRED TO PROV IN HMO(S): {"
        .StatusBar = "Waiting for Prompt: ALLOW AS REFERRED TO PROV IN HMO(S): {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1

        Wend
        
        
        If aSheet.Cells(x, 2).Text <> "HMO - QUEUE FOR REFERRAL NOTICE?:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HMO - QUEUE FOR REFERRAL NOTICE?: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: ALLOWED CHART BORROWER?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: REASON FOR CHART SUSPENSION: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: REPORTING CATEGORY #1: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: REPORTING CATEGORY #2: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: REPORTING CATEGORY #3: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: ASSOCIATED HMO RISK POOL: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "ALLOW AS MEDICAL PRACTICE IN HMO:" Then
            .Transmit CR
        Else
        While .StatusBar = "Waiting for Prompt: ALLOW AS MEDICAL PRACTICE IN HMO: {"
        .StatusBar = "Waiting for Prompt: ALLOW AS MEDICAL PRACTICE IN HMO: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1

        Wend
        
        
        If aSheet.Cells(x, 2).Text <> "ASSOCIATED HMO MEDICAL PRACTICE:" Then
            .Transmit CR
        Else
        While .StatusBar = "Waiting for Prompt: ASSOCIATED HMO MEDICAL PRACTICE: {"
        .StatusBar = "Waiting for Prompt: ASSOCIATED HMO MEDICAL PRACTICE: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1

        Wend
        
        .StatusBar = "Waiting for Prompt: BAR G/L CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: PATIENT REFUND G/L CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: FUNCTION IN CRS?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: GHAA FACILITY TYPE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: GHAA PROVIDER TYPE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: GHAA PHYSICIAN SPECIALTY: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        .StatusBar = "Waiting for Prompt: HMO - VALID CAPITATION AGREEMENT TYPES: {"
        '.WaitForString "S:" & ESC & "[0m" & ESC & "[0m" & ESC & "[18;43H " & ESC & "[0m                              " & ESC & "[0m" & ESC & "[0m" & ESC & "[18;76H" & ESC & "[0m   " & ESC & "[21;24r" & ESC & "[18;74H}" & ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: DOES PHYSICIAN HAVE MEDICARE PIN #?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "HMO - ALLOW AS PCP FOR PLAN TYPE(S):" Then
            .Transmit CR
        Else
        While .StatusBar = "Waiting for Prompt: HMO - ALLOW AS PCP FOR PLAN TYPE(S): {"
        
        .StatusBar = "Waiting for Prompt: HMO - ALLOW AS PCP FOR PLAN TYPE(S): {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1

        Wend
        
        
        .StatusBar = "Waiting for Prompt: USE SECONDARY MD AS BILLING MD?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: PLAN TYPE(S): {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: ON CALL MD: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO REFERRAL G/L DEBIT CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO REFERRAL G/L CREDIT CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: DATE STARTED AT PAMF: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CLAIMS A/P ENTITY: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: DATE LEFT PAMF: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CAPITATION G/L APPROVED CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO PREMIUM BILLING G/L DEBIT CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO PREMIUM BILLING G/L CREDIT CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO STAT CLAIMS G/L DEBIT CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO STAT CLAIMS G/L CREDIT CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: PROVIDER SEARCH BRIEF COMMENTS: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CAPITATION G/L WITHHOLD CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: PROVIDER SEARCH DETAILED COMMENTS: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CLAIMS G/L APPROVED CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CLAIMS G/L WITHHOLD CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CLAIMS G/L DISCOUNT CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: REFERRAL AREA: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CLAIMS G/L CASH CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: CORRESPONDING CAPITATION VENDOR: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CAPITATION G/L CASH CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "EFFECTIVE DATE OF PCP:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: EFFECTIVE DATE OF PCP: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: HMO MEMBER MONTHS G/L CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CAPITATION A/P ENTITY: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO PRACTICE SITE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: GHAA PROFESSIONAL PROVIDER SPECIALTY: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: REQUIRES SUPERVISION?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: PROVIDER STATUS: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: EMPLOYEE OF THE PRACTICE?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: POINT OF SERVICE OPTION: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: PHYSICIAN COVERAGE GROUP: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CAPITATED ENTITY G/L APPROVED CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CAPITATED ENTITY G/L WITHHOLD CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CAPITATED ENTITY G/L CASH CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO INCOMING CAPITATION G/L DEBIT CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CLAIMS G/L BILLED CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO CLAIMS G/L CONTRA CODE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "Panel Size Limit:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Panel Size Limit: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: FIRST YEAR OF PRACTICE (MEDICARE): {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: PARTICIPATING: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Valid Divisions: {"
        '.WaitForString "s:" & ESC & "[0m" & ESC & "[0m" & ESC & "[18;43H " & ESC & "[0m                              " & ESC & "[0m" & ESC & "[0m" & ESC & "[18;76H" & ESC & "[0m   " & ESC & "[21;24r" & ESC & "[18;74H}" & ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: ALTERNATE DISPLAY FIELD FOR PHY LOOKUP: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "First line street address:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Clinical, First line street address: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: Clinical, Second line street address: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "Clinical, City,state zip:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Clinical, City,state zip: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "Clinical, Telephone #:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Clinical, Telephone #: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "HIS PRIMARY SERVICE:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HIS PRIMARY SERVICE: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: HIS PRO CODE: {"
        '.WaitForString "E:" & ESC & "[0m" & ESC & "[0m" & ESC & "[18;43H " & ESC & "[0m                              " & ESC & "[0m" & ESC & "[0m" & ESC & "[18;76H" & ESC & "[0m   " & ESC & "[21;24r" & ESC & "[18;74H}" & ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS NON-STAFF PHYSICIAN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS OFFICE TELEPHONE NUMBER: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS OFFICE ADDRESS LINE 1: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS OFFICE ADDRESS LINE 2: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS OFFICE CITY,STATE ZIP: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS PAGE CALLING NUMBER: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "HIS ADMITTING PRIVILEGE COMMENT:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HIS ADMITTING PRIVILEGE COMMENT: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: HIS PROVIDER CREDENTIALS: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS PROVIDER HOME TELEPHONE NUMBER: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS MEDICAL RECORDS CATEGORY: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        If aSheet.Cells(x, 2).Text <> "HIS ALLOWABLE SERVICES:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HIS ALLOWABLE SERVICES: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: HIS ADMITTING PRIVILEGES STATUS: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS TITLE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS IS THIS PROVIDER A RESIDENT ?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: NEIC #: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Email Address: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: verification/acknowledgement: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_1: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_2: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_3: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_4: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_5: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "HIS Primary Care, Specialist or Both?:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HIS Primary Care, Specialist or Both?: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: HMO_PIN_6: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HPA GL Charge Credit Account # Piece: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_7: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_8: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_9: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Billing Provider?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Claims G/L Interest Penalty code: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Can this provider require a UB92?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Country: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Is this a hospice employee?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: CLIA Number: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
            
        If aSheet.Cells(x, 2).Text <> "WebMD Provider Specialty Code:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: WebMD Provider Specialty Code: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: DEA#: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HPA G/L Pym/Adj Credit Account # Piece: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HPA G/L Pym/Adj Debit Account # Piece: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Charge Entry Action Sequence: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: FACILITY 4 PIN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: FACILITY 8 PIN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: FACILITY 15 PIN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: FACILITY 14 PIN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: MEDI-CAL GROUP NO: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Division G/L Code#: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: RAILROAD MEDICARE GRP #: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
            
        If aSheet.Cells(x, 2).Text <> "RegistrationPCPn?:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: RegistrationPCPn?: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: Patient User Interfaces: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Billing Option: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: OB Epidural Face to Face Billing: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Duration (mins): {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Deactivation Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: System Effective Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: System Expiration Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Deleted Flag: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: DEACTIVATION FLAG: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Creation Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Creation Username: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Update Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Update Username: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Creation Time: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Update Time: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Deactivated By: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: System Entry Flag: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: OB Epidural Face to Face Billing: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        'Press VtF7 (Perform the Vt F7 function).
        If .aSheet.Cells(x, 2).Text = "NAME:" Then
            .TransmitTerminalKey rcVtF10Key
        Else
            Exit Sub
        End If

Wend
   

ErrorHandler:
    .TransmitTerminalKey rcVtF7Key
    .Transmit "Q"
    appExcel.Quit
    
End Sub
 
Well, in the code that you posted I don't see any Wend that closes this While block:

While aSheet.UsedRange.Rows.Count <> 13954

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Oops...some of my code got left out somehow. Here's the rest. Sorry about the length.

Code:
.StatusBar = "Waiting for Prompt: PARTICIPATING: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Valid Divisions: {"
        '.WaitForString "s:" & ESC & "[0m" & ESC & "[0m" & ESC & "[18;43H " & ESC & "[0m                              " & ESC & "[0m" & ESC & "[0m" & ESC & "[18;76H" & ESC & "[0m   " & ESC & "[21;24r" & ESC & "[18;74H}" & ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: ALTERNATE DISPLAY FIELD FOR PHY LOOKUP: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "First line street address:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Clinical, First line street address: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: Clinical, Second line street address: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "Clinical, City,state zip:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Clinical, City,state zip: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "Clinical, Telephone #:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: Clinical, Telephone #: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If
        
        If aSheet.Cells(x, 2).Text <> "HIS PRIMARY SERVICE:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HIS PRIMARY SERVICE: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: HIS PRO CODE: {"
        '.WaitForString "E:" & ESC & "[0m" & ESC & "[0m" & ESC & "[18;43H " & ESC & "[0m                              " & ESC & "[0m" & ESC & "[0m" & ESC & "[18;76H" & ESC & "[0m   " & ESC & "[21;24r" & ESC & "[18;74H}" & ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS NON-STAFF PHYSICIAN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS OFFICE TELEPHONE NUMBER: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS OFFICE ADDRESS LINE 1: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS OFFICE ADDRESS LINE 2: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS OFFICE CITY,STATE ZIP: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS PAGE CALLING NUMBER: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "HIS ADMITTING PRIVILEGE COMMENT:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HIS ADMITTING PRIVILEGE COMMENT: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: HIS PROVIDER CREDENTIALS: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS PROVIDER HOME TELEPHONE NUMBER: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS MEDICAL RECORDS CATEGORY: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        If aSheet.Cells(x, 2).Text <> "HIS ALLOWABLE SERVICES:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HIS ALLOWABLE SERVICES: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: HIS ADMITTING PRIVILEGES STATUS: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS TITLE: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HIS IS THIS PROVIDER A RESIDENT ?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: NEIC #: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Email Address: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: verification/acknowledgement: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_1: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_2: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_3: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_4: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_5: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
        
        If aSheet.Cells(x, 2).Text <> "HIS Primary Care, Specialist or Both?:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: HIS Primary Care, Specialist or Both?: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: HMO_PIN_6: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HPA GL Charge Credit Account # Piece: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_7: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_8: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HMO_PIN_9: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Billing Provider?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Claims G/L Interest Penalty code: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Can this provider require a UB92?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Country: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Is this a hospice employee?: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: CLIA Number: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
            
        If aSheet.Cells(x, 2).Text <> "WebMD Provider Specialty Code:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: WebMD Provider Specialty Code: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: DEA#: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HPA G/L Pym/Adj Credit Account # Piece: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: HPA G/L Pym/Adj Debit Account # Piece: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Charge Entry Action Sequence: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: FACILITY 4 PIN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: FACILITY 8 PIN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: FACILITY 15 PIN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: FACILITY 14 PIN: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: MEDI-CAL GROUP NO: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Division G/L Code#: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: RAILROAD MEDICARE GRP #: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR
            
        If aSheet.Cells(x, 2).Text <> "RegistrationPCPn?:" Then
            .Transmit CR
        Else
        .StatusBar = "Waiting for Prompt: RegistrationPCPn?: {"
        .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        .StatusBar = ""
        .Transmit aSheet.Cells(x, 1).Text, 1
        .Transmit CR
        x = x + 1
        End If

        .StatusBar = "Waiting for Prompt: Patient User Interfaces: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Billing Option: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: OB Epidural Face to Face Billing: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Duration (mins): {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Deactivation Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: System Effective Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: System Expiration Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Deleted Flag: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: DEACTIVATION FLAG: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Creation Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Creation Username: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Update Date: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Update Username: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Creation Time: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Update Time: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: Deactivated By: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: System Entry Flag: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        .Transmit CR

        .StatusBar = "Waiting for Prompt: OB Epidural Face to Face Billing: {"
        '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
        '.StatusBar = ""
        'Press VtF7 (Perform the Vt F7 function).
        If .aSheet.Cells(x, 2).Text = "NAME:" Then
            .TransmitTerminalKey rcVtF10Key
        Else
            Exit Sub
        End If
End With
Wend
   

ErrorHandler:
    .TransmitTerminalKey rcVtF7Key
    .Transmit "Q"
    appExcel.Quit
    
    
    
End Sub
 
I am not sure what you exactly wanting but to fix the error i think the last lines of code are

Code:
                              Else
                                    Exit Sub
                                End If
                            End If
                        End If
                    End If
                End If
            End If
                End With
            Wend

You have about 5 if statements that are not closed out

ck1999
 
If aSheet.Cells(x, 2).Text <> "HMO - ALLOW AS PCP FOR PLAN TYPE(S):" Then

If aSheet.Cells(x, 2).Text <> "ASSOCIATED HMO MEDICAL PRACTICE:" Then

If aSheet.Cells(x, 2).Text <> "ALLOW AS MEDICAL PRACTICE IN HMO:" Then

If aSheet.Cells(x, 2).Text <> "ALLOW AS REFERRED TO PROV IN HMO(S):" Then

If aSheet.Cells(x, 2).Text <> "ALLOW AS PCP IN HMO(S):" Then

These are listed from bottom up

ck1999
 
Yes please. Use Indenter.

scriptscribe, in the future, could you please make effort to reduce the code you post. If there is something we need/want to know, believe me, we will ask. You could reduce the amount - besides using Indenter to find them - by doing things like removing obvious parts that are not relevant. Again, if there is something missing someone thinks may be relevant, they will ask.

For example:
Code:
.StatusBar = "Waiting for Prompt: EMPLOYEE OF THE PRACTICE?: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

  .StatusBar = "Waiting for Prompt: POINT OF SERVICE OPTION: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

  .StatusBar = "Waiting for Prompt: PHYSICIAN COVERAGE GROUP: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

  .StatusBar = "Waiting for Prompt: HMO CAPITATED ENTITY G/L APPROVED CODE: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

  .StatusBar = "Waiting for Prompt: HMO CAPITATED ENTITY G/L WITHHOLD CODE: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

  .StatusBar = "Waiting for Prompt: HMO CAPITATED ENTITY G/L CASH CODE: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

  .StatusBar = "Waiting for Prompt: HMO INCOMING CAPITATION G/L DEBIT CODE: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

  .StatusBar = "Waiting for Prompt: CODE: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

  .StatusBar = "Waiting for Prompt: HMO CLAIMS G/L BILLED CODE: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

  .StatusBar = "Waiting for Prompt: HMO CLAIMS G/L CONTRA CODE: {"
  '.WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
  '.StatusBar = ""
  .Transmit CR

These have no logic (If/Else or While/Wend), they could be replaced by:
Code:
' Other stuff


And, things like:
Code:
If aSheet.Cells(x, 2).Text <> "RegistrationPCPn?:" Then
   .Transmit CR
Else
   .StatusBar = "Waiting for Prompt: RegistrationPCPn?: {"
   .WaitForString ESC & "[33D{", NEVER_TIME_OUT, rcAllowKeystrokes
   .StatusBar = ""
   .Transmit aSheet.Cells(x, 1).Text, 1
   .Transmit CR
   x = x + 1
End If
as they are very clearly a whole complete logic statements, could be written as:
Code:
If aSheet.Cells(x, 2).Text <> "RegistrationPCPn?:" Then
   .Transmit CR
Else
   ' the If/Else stuff
End If
Now, if you did that you could have MUCH smaller posted code, something like (snippet):
Code:
While aSheet.UsedRange.Rows.Count <> 13954
  With Session
     ' start of Other stuff
     If aSheet.Cells(x, 2).Text <> "UPIN NUMBER:" Then
        .Transmit CR
     Else
        ' the If/Else stuff
     End If

     If aSheet.Cells(x, 2).Text <> "AKA NAME:" Then
       .Transmit CR
     Else
       ' the If/Else stuff
     End If

     If aSheet.Cells(x, 2).Text <> "HIPAA Provider ID:" Then
        .Transmit CR
     Else
        ' the If/Else stuff
     End If
which makes it easier for anyone else - us...and YOU - to read.

Going further, as those If/Else statement are clearly complete, and closed, you can then remove the numerous examples, ending up with something like:
Code:
While aSheet.UsedRange.Rows.Count <> 13954
  With Session
    ' start of Other stuff using With
    ' bunch of closed If/Else
    ' other stuff
    ' bunch of closed If/Else      
    ' other stuff
    ' closed If Else
     While .StatusBar = "Waiting for Prompt: BILLING AREA(S): {"
        ' the While stuff
     Wend

     ' other stuff

      While .StatusBar = "Waiting for Prompt: LOCATION(S): {"
         ' the While stuff
      Wend

      ' closed If/Else
      ' other stuff
      ' closed If/Else
      ' other stuff
Getting there.

NOW, you can get rid of those comment lines ( ' closed If/Else etc.) Ending up with (snippet):
Code:
While aSheet.UsedRange.Rows.Count <> 13954
  With Session
     While .StatusBar = "Waiting for Prompt: BILLING AREA(S): {"
       ' the While stuff
     Wend
     While .StatusBar = "Waiting for Prompt: LOCATION(S): {"
       ' the While stuff
     Wend
     If aSheet.Cells(x, 2).Text <> "ALLOW AS PCP IN HMO(S):" Then
        .Transmit CR
     Else
        While .StatusBar = "Waiting for Prompt: ALLOW AS PCP IN HMO(S): {"
        ' the While stuff
        Wend
        If aSheet.Cells(x, 2).Text <> "ALLOW AS REFERRED TO PROV IN HMO(S):" Then
          .Transmit CR
        Else
          While .StatusBar = "Waiting for Prompt: ALLOW AS REFERRED TO PROV IN HMO(S): {"
             ' the While stuff
          Wend

Going further, let's replace things like:
Code:
.StatusBar = "Waiting for Prompt: ALLOW AS REFERRED TO PROV IN HMO(S): {"

and:
Code:
If aSheet.Cells(x, 2).Text <> "ALLOW AS PCP IN HMO(S):" Then
with "Yadda", e.g.
Code:
If Yadda Then
you end up with, ALL your code, as:
Code:
Option Explicit
Private Sub CommandButton1_Click()
   On Error GoTo ErrorHandler
   'Extra Objects
   'Dim ExScreen As Object
   'Set ExScreen = System.ActiveSession.Screen

   Const NEVER_TIME_OUT = 0
   Dim appExcel As Object
   Dim wbExcel As Object
   Dim aSheet As Object
   Dim CR As String
   Dim ESC As String   ' Chr(rcESC) = Chr(27) = Control-[
   Dim x As Integer


   Set appExcel = CreateObject("Excel.Application")
   Set wbExcel = appExcel.WorkBooks.Open("C:/Test3.xls")
   Set aSheet = wbExcel.Sheets("Sheet1")
   '.TransmitTerminalKey rcVtEnterKey
   CR = Chr(Reflection2.ControlCodes.rcCR)
   ESC = Chr(Reflection2.ControlCodes.rcESC)
   x = 1

   While aSheet.UsedRange.Rows.Count <> 13954
      With Session
         While Yadda
            ' the While stuff
         Wend
         While Yadda
            ' the While stuff
         Wend
         If Yadda Then
            .Transmit CR
         Else
            While Yadda
               ' the While stuff
            Wend
            If Yadda Then
               .Transmit CR
            Else
               While Yadda
                  ' the While stuff
               Wend
               If Yadda Then
                  .Transmit CR
               Else
                  While Yadda
                     ' the While stuff
                  Wend
                  If Yadda Then
                     .Transmit CR
                  Else
                     While Yadda
                           ' the While stuff
                     Wend
                     ' other stuff
                     If Yadda Then
                        .Transmit CR
                     Else
                        While Yadda
                           ' the While Stuff
                        Wend
                        If Yadda Then
                           .TransmitTerminalKey rcVtF10Key
                        Else
                           Exit Sub
                        End If
                     End With
                  Wend


ErrorHandler:
   .TransmitTerminalKey rcVtF7Key
   .Transmit "Q"
   appExcel.Quit
End Sub

It becomes clearly obvious, that ck1999 is bang on. You have a number of unterminated logic statements.

Indenter will show these as a rather glaring gap, like this:
Code:
                        If Yadda Then
                           .TransmitTerminalKey rcVtF10Key
                        Else
                           Exit Sub
                        End If
                     End With
                  Wend

[COLOR=red]' hmmmmm, it sure looks like some code
' should go here[/color red]

ErrorHandler:
   .TransmitTerminalKey rcVtF7Key
   .Transmit "Q"
   appExcel.Quit
End Sub

You would be able to see that even the last logic statement is NOT closed.
Code:
  [COLOR=red]If[/color red] Yadda Then
     .Transmit CR
  [COLOR=red]Else[/color red]
     While Yadda
        ' the While Stuff
     Wend
     If Yadda Then
        .TransmitTerminalKey rcVtF10Key
     Else
        Exit Sub
     End If
        ' THIS If/Else is closed
    ' the one is red is NOT closed
End With

My point being is that simplifying the code you post helps us because we do not have to wade through extraneous code, but also helps YOU, in that it makes it clearer where the problem may be.

Your error messages are on logic statements ("While without Wend", "Loop without For"). Reducing the statements to their structure - as their instruction content is not the issue - narrows the debugging process to its essentials.

I would suggest that when you make logic statements, you always close them before you add content.

Use an If.....put in an End If.

But get Indenter, it can help. In any case, ck1999 is right.

faq219-2884

Gerry
My paintings and sculpture
 
[offtopic]

star.gif
to PHV for the Smart Indenter tip. That's the first I've heard of it, and it is really cool. I indent my code anyway, but this is a nice way to ensure that everything is standardized. (I like things to be parallel.)

[/offtopic]

star.gif
-> Gerry as well. That post must have taken a few minutes to compose!

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
anotherhiggins, actually not. The total time to copy over the OP's code rather (no offense) long-winded code, and scan through for reducing chunks, then second level reducing chunks...and write the post itself....maybe twenty-five minutes.

In fact, that is also part of my point. Reducing things to chunks is (or should be) a normal aspect of debugging. It was not hard to scan through, see the whopping long chunks of NON-logic instructions, and reduce them to " ' other stuff ". Put " ' other stuff" into the clipboard, select the long other stuff chunks, and delete then replace. Once THAT was done it reduced the visible code by almost 50%.

I must admit I cheat a little. I copy VBA code into a Word template that has these kind of things as part of its function. For example, it has " ' other stuff" as an AutoText. I can select chunks of code that I can see are "other stuff", delete, type "oth" and press F3. That chunk is replaced with " ' other stuff".

It also has code that runs through the text (i.e. the code as text) and removes my reducing comments. E.g. " ' other stuff"; " ' closed If/Else".

The original code remains in the module, I examine a copy of it in Word, with my own sort of debugging tools. It does not work all the time, but it can work to reduce things to much easier code to examine. Shrug.

SmartIndenter is a great help though. While it does not sound bells and buzzers to identify where there is a problem, it DOES - especially for code like the OP has - make it pretty darn visible that something is missing.

I have been using it for the last year or two (from an earlier suggestion from PHV!). It catches me sometimes, not often though. I tend to be careful about things like proper indents, and closed logic statements. It makes it so much easier. I do not think I have had a While without Wend, Loop with For etc. in quite a while. Part of that is I tend to really try and break long procedures up. As you well know, this also makes debugging easier.

faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top