+ Reply to Thread
Results 1 to 2 of 2

Grab name of folder

  1. #1
    Forum Contributor
    Join Date
    09-27-2004
    Posts
    133

    Question Grab name of folder

    Excel 2002 with Visual Basic 6.3

    The code below allows me to select a desired folder, but I then need to assign the name of that folder to a varibale. I'm at a loss right now.


    Please Login or Register  to view this content.

  2. #2
    Chip Pearson
    Guest

    Re: Grab name of folder

    Try

    Sub GetAFolder()
    Dim FolderName As String
    With Application.FileDialog(msoFileDialogFolderPicker)
    .InitialFileName = Application.DefaultFilePath & "\"
    .Show
    If .SelectedItems.Count = 0 Then
    MsgBox "Canceled"
    Else
    FolderName = .SelectedItems(1)
    End If
    End With

    End Sub



    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "scantor145"
    <[email protected]> wrote
    in message
    news:[email protected]...
    >
    > Excel 2002 with Visual Basic 6.3
    >
    > The code below allows me to select a desired folder, but I then
    > need to
    > assign the name of that folder to a varibale. I'm at a loss
    > right now.
    >
    >
    >
    > Code:
    > --------------------
    > Sub GetAFolder()
    >
    > With Application.FileDialog(msoFileDialogFolderPicker)
    > .InitialFileName = Application.DefaultFilePath & "\"
    > .Show
    > If .SelectedItems.Count = 0 Then
    > MsgBox "Canceled"
    > Else
    > MsgBox .SelectedItems(1)
    > End If
    > End With
    >
    > End Sub
    > --------------------
    >
    >
    > --
    > scantor145
    > ------------------------------------------------------------------------
    > scantor145's Profile:
    > http://www.excelforum.com/member.php...o&userid=14766
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=383858
    >




+ 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