How do I get this code to look in a certain directory
Application.GetOpenFilename
Directory name
ward5
Thanksin advance
Greg
How do I get this code to look in a certain directory
Application.GetOpenFilename
Directory name
ward5
Thanksin advance
Greg
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
Thanks once again
It is exactly what i want
Greg
Dim s
ChDir "C:\Folder\folder2\folder you want"
s = Application.GetOpenFilename
tim
"Greg" <gregslaptop@ihug.com.au> wrote in message
news:cv8prp$pb2$1@lust.ihug.co.nz...
> How do I get this code to look in a certain directory
>
> Application.GetOpenFilename
>
> Directory name
>
> ward5
>
> Thanksin advance
>
> Greg
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks