Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Default File path

Steph,
You can use ChDir before your call to GetOpenFilename.

Also, you have MultiSelect=false, so a string will be return and your code
will always exit as you will never get an array.
Looks like you want to set MultiSelect=True instead.
You should also check for a return value False, in case the user cancelled.

NickHK

"Steph" wrote in message
...
Hi everyone. Below is a piece of code that allows the user to browse to a
location on the network and select a file to open. Is there a way to
default to a specific path? For example, default to C:\Documents and
Settings\All Users. Thanks!


Sub GetDataFile()
Dim v As Variant, i As Long, bk As Workbook

Application.ScreenUpdating = False
Application.DisplayAlerts = False

v = Application.GetOpenFilename(MultiSelect:=False)
If Not IsArray(v) Then Exit Sub
For i = LBound(v) To UBound(v)
Set bk = Workbooks.Open(v(i))





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
Problem with default file path opi Excel Programming 6 March 29th 06 01:21 PM
Default Path for File Open gilgil Excel Programming 2 March 6th 05 10:36 AM
Default File Path Kevin Excel Programming 2 September 28th 04 05:09 PM
Default File Path papou[_9_] Excel Programming 0 July 8th 04 02:49 PM
Default File Path Tom Ogilvy Excel Programming 0 July 8th 04 02:38 PM


All times are GMT +1. The time now is 05:37 AM.

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"