Results 1 to 4 of 4

Thread: Browse & Select a File, Folder using VBA

  1. #1

    Browse & Select a File, Folder using VBA

    Register for a FREE account, and/
    or Log in to avoid these ads!

    Attached is a macro enabled workbork that will allow you to Browse and Select a File or Folder Path into the worksheet automatically, instead of manually typing the full path. The Macro will also copy the same path to multiple locations in the spreadsheet based on common keywords. IT uses the file dialog to browse to a UDL (must enter the full http path).

    This code, as it is, works as designed. However, instead of being presented with multiple dialogs (i.e A file dialog box or a Folder dialog box), I would like to merge the 2 into one. I would also like to be able to incorprate Browse to a URL more efficiently.

    Any ideas?
    Attached Files Attached Files
    Last edited by GaryA; 2012-04-26 at 07:36 PM.

  2. #2
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Nanaimo, BC, Canada
    Blog Entries
    Excel Version
    Excel Office 365 Insider
    Hi Gary,

    I'll try and take a look at this over the weekend. I don't anticipate the file/folder part being too difficult. The other I'm not sure about, but I'll give it a go.
    Ken Puls, FCPA, FCMA, MS MVP

    Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!

    Main Site: -||- Blog: -||- Forums:
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  3. #3
    Super Moderator Zack Barresse's Avatar
    Join Date
    Mar 2011
    Oregon, United States
    Excel Version
    365, Online, iOS, iOS for iPad

    A couple of quick comments regarding the code. I'm not sure you need to do the selecting you do with the code. Also, I wouldn't bank on the ActiveCell, like you do with this line..
    ActiveCell.Value = ConvertDrive2ServerName(Fname)
    But rather set to a variable, then set the cell value by that variable. You go on further to look at the ActiveCell Value, which you should be checking the variable you would've just set. Much less problemmatic.

    This line confuses me:
    ActiveSheet.Range("Procedure_Artifact_Group").AutoFilter Field:=6, Criteria1:=ArtifactValue
    Your "Procedure_Artifact_Group" is in a single column, from rows 2 to 109, but you set your Field as 6, when it should be a 1 (think columns).

    As per your original request, I would recommend perhaps incorporating this into a UserForm, where both controls would be visible to the user. Unfortunately it is going to be one or the other (file or folder), so a control with both available might be the way to go.

    Zack Barresse

  4. #4
    Thanks Zack, I'll incorporate your feedback. Yeah, a single Userform is probably the only way to go. I gen something up.

Posting Permissions

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