Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA - Invalid Qualifier with Err (2000 SR1)

    Hi Folks,

    I wrote a simple routine for selecting files using Application.GetOpenFilename. There is an error handler as follows:

    <pre>ErrorTrap:
    Select Case Err.Number
    Case 13
    Exit Sub

    Case Else
    ' Some unexpected error, report it to user.
    MsgBox "ET Phone Home!"

    End Select ' Case Err.Number
    </pre>


    In my original template, it works fine. A colleagure copied it exactly into a project of his own, generated a template and sent it out. In his template, when the routine in question is invoked, we get a compilation error, "Invalid qualifier", with the Err highlighted.

    Furthermore, if I start typing "Err." in my code, the "auto-complete" list of properties and methods pops up, but if I do the same in his code, no context list pops up. What is happening here? Thanks!

    I will cross-post in the VB/VBA forum.

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

    Re: VBA - Invalid Qualifier with Err (2000 SR1)

    I have two comments:

    First, it sounds like your colleague does not have a reference to a needed object library. In VBE go to Tools References and see if Visual Basic for Applications, Microsoft Excel 9.0 Object Library, and Microsoft Office 9.0 Object Library all have checks next to them. I'm not sure which one is needed for ERR, but I am sure it is in one of those.

    Second, I hope that this is not all of your error routine. You need a Resume statement to get out of error handler mode.
    Legare Coleman

  3. #3
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA - Invalid Qualifier with Err (2000 SR1)

    Legare,

    Thanks for the response. Do you mean, double-check on my colleague's computer? If I open his template on my system, then check the references, here is the list:

    Visual Basic for Applications
    Microsoft Excel 9.0 Object Library
    OLE Automation
    Microsoft Office 9.0 Object Library
    Microsoft Forms 2.0 Object Library
    Ref Edit Control

    This is the same list I get when I check with any of my own original projects (even with no workbook at all opened).

    Thanks again!

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

    Re: VBA - Invalid Qualifier with Err (2000 SR1)

    Yes, you must check the references on your Colleagues computer. References are associated with the installation of Excel, not a particular workbook.
    Legare Coleman

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: VBA - Invalid Qualifier with Err (2000 SR1)

    Hi Legare,
    Can I just add for the sake of clarity that the available references are specific to the machine that Excel is installed on. The used references are workbook-specific, hence the problems - a workbook can have a reference to something that is not available on the machine it's being run on.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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