+ Reply to Thread
Results 1 to 5 of 5

Application.GetOpenFilename Type mismatch error

  1. #1
    Registered User
    Join Date
    07-14-2010
    Location
    Snowmass, Colorado
    MS-Off Ver
    Excel 2007
    Posts
    30

    Application.GetOpenFilename Type mismatch error

    I am having a problem with Application.GetOpenFilename.

    I am opening up a dialog box that allows a user to choose one or more files.

    Briefly, the problem is this. Everything works well in the code below unless the user clicks cancel on the dialog box. Then I get a run time error '13': Type mismatch. On the line with Application.GetOpenFilename. My code is below.

    Any thoughts would be appreciated, this is driving me crazy!!

    Please Login or Register  to view this content.
    Last edited by brl8; 01-03-2011 at 04:57 PM. Reason: Mark solved

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Application.GetOpenFilename Type mismatch error

    Please Login or Register  to view this content.
    Consider getting in the habit of passing arguments be name rather than position.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    07-14-2010
    Location
    Snowmass, Colorado
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Application.GetOpenFilename Type mismatch error

    Thank you for your response shg,

    That was actually what my code looked like initially. I changed it back per your suggestion and I'm still getting the type mismatch error. I've even updated the Application.GetOpenFilename command in case I had something slightly wrong there. I've attached the updated code.

    Any thoughts will be appreciated as I can't figure out what is going on.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Application.GetOpenFilename Type mismatch error

    You've still got FileName declared as a dynamic Variant array. It should be declared as a simple Variant as in my example.

  5. #5
    Registered User
    Join Date
    07-14-2010
    Location
    Snowmass, Colorado
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Application.GetOpenFilename Type mismatch error

    Oops I missed that! That did it, thanks so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1