+ Reply to Thread
Results 1 to 4 of 4

GetOpenFilename - Excel 2003 vs 2010

  1. #1
    Registered User
    Join Date
    06-07-2011
    Location
    boston, ma
    MS-Off Ver
    Excel 2003
    Posts
    22

    GetOpenFilename - Excel 2003 vs 2010

    I've been given a project to test macros to see if they will function in both Excel 2003 and 2010. I came across one workbook where I found a slight difference when using Excel 2010.

    Please Login or Register  to view this content.
    When using this code, I was tasked with seeing if in the Confirm Message Box the 2 selected files could accidentally be selected incorrectly and be correctly displayed. I wanted to see if the selected file for File_Text would show up under File_dRn and vice a versa.

    When I ran the macro in Excel 2010, no matter what order I selected the files (File_Text first or second or File_dRn first or second), GetFiles(2) would always be assigned to File_Text and GetFiles(1) would always be assigned to File_dRn. I could never have this reversed.

    Is there something different between Excel 2003 and 2010 that would explain what is going on?

    Thank you for the help.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: GetOpenFilename - Excel 2003 vs 2010

    I don't understand your question-the code explicitly assigns each file to a different variable. however I would never recommend using a multi-select option if it's important which file goes to which variable-I would always use two getopenfilename statements
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    06-07-2011
    Location
    boston, ma
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: GetOpenFilename - Excel 2003 vs 2010

    Thank you for the quick response back. I do understand that the code does state that each file will be assigned to a specific variable. With my testing there were 2 different scenarios being tested:

    1. File_Text = GetFiles(2)
    File_dRn = GetFiles(1)

    2. File_Text = GetFiles(1)
    File_dRn = GetFiles(2)

    When I ran the code for scenario #1, everything worked fine. It was expected to show the correct Confirm message box. However, when I ran the code for scenario #2, the Confirm message box display was not expected. The message box had reversed the files selected. So, File_Text = GetFiles(1) became GetFiles(2) and File_dRn = GetFiles(2) became GetFiles(1).

    I had a couple other people try to run the code and they all had the same response. I guess what I am asking is if Excel 2010 has a built-in feature that if a code is run multiple times with the same files being selected in the same order, it will recognize this and correct any errors in the file selection?

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: GetOpenFilename - Excel 2003 vs 2010

    there is as far as I know no documentation to indicate the order in which multiple selected files will be returned which is why I would not use one operation if the order is important

+ 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