+ Reply to Thread
Results 1 to 3 of 3

Cancel button with GetOpenFilename()

  1. #1
    Registered User
    Join Date
    06-13-2011
    Location
    Boulder, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    61

    Cancel button with GetOpenFilename()

    I've written quite a few macros that aid in the analysis of my collected experimental data. I'm now creating a user form that will display buttons for each of the macros I've written. However, as the first action of every button I want to include a macro to facilitate loading the tab delimited data. I recorded a macro of me importing the data with the settings I want and have been trying to incorporate this with GetOpenFilename() however if the cancel button is chosen from the file chooser the program crashes. I've tried various methods but they all seem to generate an error. Any help would be greatly appreciated.

    Please Login or Register  to view this content.
    Last edited by Impartial Derivative; 07-26-2011 at 11:37 AM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Cancel button with GetOpenFilename()

    I've never seen that Workbooks.OpenFilename function before, so I can't comment on that, but for the issue with the cancel button, you need to put False in quotes. You could also just exit the sub on that line, rather than using a Goto like this:

    Please Login or Register  to view this content.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    06-13-2011
    Location
    Boulder, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    61

    Re: Cancel button with GetOpenFilename()

    Dave,

    Thank you for your input, it ended up working just as I had hoped so thank you very 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