+ Reply to Thread
Results 1 to 4 of 4

Application.GetOpenFilename

  1. #1
    Greg
    Guest

    Application.GetOpenFilename

    How do I get this code to look in a certain directory

    Application.GetOpenFilename

    Directory name

    ward5

    Thanksin advance

    Greg



  2. #2
    Dave Peterson
    Guest

    Re: Application.GetOpenFilename

    One way for mapped drives (assigned to letters):

    Option Explicit
    Sub testme()

    Dim myFolder As String
    Dim myFileName As Variant
    Dim ExistingFolder As String

    myFolder = "C:\my documents\excel\test"

    ExistingFolder = CurDir

    ChDrive myFolder
    ChDir myFolder

    myFileName = Application.GetOpenFilename(filefilter:="Excel Files, *.xls")

    ChDrive ExistingFolder
    ChDir ExistingFolder

    If myFileName = False Then
    'do nothing
    Else
    MsgBox myFileName
    'and the rest of your code
    End If

    End Sub

    Greg wrote:
    >
    > How do I get this code to look in a certain directory
    >
    > Application.GetOpenFilename
    >
    > Directory name
    >
    > ward5
    >
    > Thanksin advance
    >
    > Greg


    --

    Dave Peterson

  3. #3
    Greg
    Guest

    Re: Application.GetOpenFilename

    Thanks once again

    It is exactly what i want

    Greg



  4. #4
    Tim Williams
    Guest

    Re: Application.GetOpenFilename

    Dim s
    ChDir "C:\Folder\folder2\folder you want"
    s = Application.GetOpenFilename

    tim

    "Greg" <[email protected]> wrote in message
    news:[email protected]...
    > How do I get this code to look in a certain directory
    >
    > Application.GetOpenFilename
    >
    > Directory name
    >
    > ward5
    >
    > Thanksin advance
    >
    > Greg
    >




+ 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