Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Application.GetOpenFilename

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

Application.GetOpenFilename

Directory name

ward5

Thanksin advance

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Application.GetOpenFilename

Thanks once again

It is exactly what i want

Greg


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Application.GetOpenFilename

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

tim

"Greg" wrote in message
...
How do I get this code to look in a certain directory

Application.GetOpenFilename

Directory name

ward5

Thanksin advance

Greg



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
GetOpenFilename Jenny Excel Programming 2 October 22nd 04 01:38 PM
How do I set a default path when using Application.GetOpenFilename pkohler[_8_] Excel Programming 2 July 13th 04 10:12 PM
How do I set a default path when using Application.GetOpenFilename pkohler[_7_] Excel Programming 2 July 13th 04 07:17 PM
Application.GetOpenFilename Philipp Oberleitner[_2_] Excel Programming 2 July 9th 04 07:29 PM
Application.GetOpenFileName ptrowe Excel Programming 2 September 11th 03 12:54 PM


All times are GMT +1. The time now is 09:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"