+ Reply to Thread
Results 1 to 7 of 7

can't find how to create a browse macro

  1. #1
    Registered User
    Join Date
    08-11-2009
    Location
    Gilbert, Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    82

    can't find how to create a browse macro

    I have looked in books and online and can't seem to locate how to create a macro that opens a browse function. From Excel I would like to click a button to start a macro and have that macro prompt me where to browse for the file. There is a lot of other code that will go after this step (which I already have), so once I click to "open" a file I want the macro to continue.

    I appreciate your help in advance!

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: can't find how to create a browse macro

    Is this what you mean?
    Please Login or Register  to view this content.
    Or
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: can't find how to create a browse macro

    This will activate the File Open dialog. Is this what you want

    Please Login or Register  to view this content.

    Edit: Posted just behind RoyUK (better/full solution).

  4. #4
    Registered User
    Join Date
    08-11-2009
    Location
    Gilbert, Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    82

    Re: can't find how to create a browse macro

    It looks like all of those get me to the same point. The file I open is a .txt file and contains a total of 39 columns. The # of rows vary depending on the file I recieve. The program I'm working on converts this text file to an excel file. The opening code looks like this:

    Please Login or Register  to view this content.
    I get the debug error where it starts at "origin." Any ideas how to mesh the code?

    thanks!

    P.S. in case you're wonding what I started with I'll include it below. The code below works but not for what I need. It opens the same file every time instead of asking me to search for the file.

    Please Login or Register  to view this content.
    Last edited by curbster; 08-28-2009 at 01:49 PM.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: can't find how to create a browse macro

    Hello curbster,

    The setting for the named argument Origin can be omitted. 437 This indicates the file was was saved in DOS-US font. Omitting the entry lets your system choose the font the closest to the original.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Registered User
    Join Date
    08-11-2009
    Location
    Gilbert, Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    82

    Re: can't find how to create a browse macro

    Hi Leith,

    that code in the editor is still red. Something is not meshing together

  7. #7
    Registered User
    Join Date
    08-11-2009
    Location
    Gilbert, Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    82

    Re: can't find how to create a browse macro

    Ok, with a little trial and error I think I got it. This seems to be working. I had to take out the "on error" and the "exit sub" and manipulate the "workbooks.open" to be "workbooks.opentext". See below:

    Please Login or Register  to view this content.
    Thanks for all of your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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