Results 1 to 6 of 6
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    not valid qualifier (2000 sr 1)

    I have set Global NOMEFOGLIO As String

    and i have this macro:

    Sub LOOPSHEET_AGGIORNA_SCHEDE_POE()

    Application.ScreenUpdating = False

    Dim i As Long
    For i = 1 To Sheets.Count
    If Mid(Sheets(i).Name, 5, 1) = "-" Then

    NOMEFOGLIO = Sheets(i).Name
    If Right(Worksheets(i).Range("B3"), 2) = "PP" Then Call POE_PP
    If Right(Worksheets(i).Range("B3"), 2) = "MF" Then Call POE_MF
    End If

    Next

    Application.ScreenUpdating = True

    End Sub

    when i call POE_PP

    i have qualifier not valid in all range of cells... in effect i would want to set NOMEFOGLIO as the actual sheet

    this is the macro POE_PP


    COPE = NOMEFOGLIO.Range("B1")
    Sess0.SCREEN.putstring COPE, 5, 28

    Sess0.SCREEN.SendKeys ("<ENTER>")
    Sess0.SCREEN.WaitHostQuiet (g_HostSettleTime)

    For Y = 9 To 19
    If Sess0.SCREEN.GETSTRING(Y, 2, 6) = "_ 4580" Then

    Sess0.SCREEN.putstring "X", Y, 2
    Sess0.SCREEN.SendKeys ("<ENTER>")
    Exit For
    End If
    Next Y

    If Sess0.SCREEN.GETSTRING(2, 2, 8) = "KDV00012" Then
    Sess0.SCREEN.putstring "X", 9, 2
    Sess0.SCREEN.SendKeys ("<ENTER>")
    'Sess0.SCREEN.WaitHostQuiet (g_HostSettleTime)
    Else

    End If
    Sess0.SCREEN.Waitforstring "KDV00014", 2, 2, 8

    Sess0.SCREEN.putstring "X", 9, 2

    Sess0.SCREEN.SendKeys ("<ENTER>")

    Sess0.SCREEN.Waitforstring "KDV00014", 2, 2, 8

    For X = 10 To 20
    If Sess0.SCREEN.GETSTRING(X, 2, 5) = "_ 127" Then

    Sess0.SCREEN.putstring "X", X, 2
    Sess0.SCREEN.SendKeys ("<ENTER>")

    Sess0.SCREEN.Waitforstring "KDV00015", 2, 2, 8

    Sess0.SCREEN.putstring "X", 12, 2

    Sess0.SCREEN.SendKeys ("<ENTER>")

    Sess0.SCREEN.Waitforstring "KDV10017", 2, 2, 8
    Exit For
    End If
    Next X

    NOMEFOGLIO.Range("B7") = "NR. INS. " & Trim(Sess0.SCREEN.GETSTRING(19, 54, 3))
    NOMEFOGLIO.Range("C7") = "CAP. RES. " & Trim(Sess0.SCREEN.GETSTRING(15, 34, 14))
    NOMEFOGLIO. Range("D7") = "IMP. INS. " & Trim(Sess0.SCREEN.GETSTRING(15, 68, 14)) '& ",00"
    NOMEFOGLIO.Range("F7") = Trim(Sess0.SCREEN.GETSTRING(13, 67, 14))

    Sess0.SCREEN.SendKeys ("<PF3>")
    Sess0.SCREEN.Waitforstring "COPE", 5, 11, 4

    End Sub

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: not valid qualifier (2000 sr 1)

    <hr>
    NOMEFOGLIO = workSheets(i).Name

    Set NOMEFOGLIO = worksheets(i)
    <hr>

    Is NOMEFOGLIO a string or a worksheet object?
    Legare Coleman

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: not valid qualifier (2000 sr 1)

    .... a "worksheet object"

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: not valid qualifier (2000 sr 1)

    Then, if it is DIMed as a worksheet object, the line:

    <code>
    NOMEFOGLIO = workSheets(i).Name
    </code>

    Should fail.
    Legare Coleman

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: not valid qualifier (2000 sr 1)

    <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30>

    I forgot to delete the line I changed...

    I corrected it in my post.

    Steve

  6. #6
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: not valid qualifier (2000 sr 1)

    <P ID="edit" class=small>(Edited by sdckapr on 12-Oct-05 20:02. Deleted line that I kept in and edited by mistake. Thanks, Legare)</P>is this what you are after?

    Global NOMEFOGLIO As <font color=red>worksheet</font color=red>

    For i = 1 To <font color=red>Work</font color=red>sheets.Count
    If Mid(<font color=red>work</font color=red>sheets(i).Name, 5, 1) = "-" Then

    <font color=red>Set </font color=red>NOMEFOGLIO = <font color=red>work</font color=red>sheets(i)

    [Note: sheets and worksheets are not the same. Sheet(i) may not be worksheets(i) if you have chart or macro sheets...]

    Steve

Posting Permissions

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