Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 20th, 2004, 03:56 PM
Authorized User
 
Join Date: Aug 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Open dialog box to a particular folder

I am currently using the following code to browse the hard drive for csv files. The files I am looking for are stored in a particular folder. The problem is that it appears that the open box opens to the location of the last opened file. I want to open the folder that contains the files I am looking for everytime. Is there a way to do this?

Public Sub cmdBrowse_Click()
    dim fileName as string
    Const iTitle = "Graph Setup"
    Const FilterList = _
        "Comma-delimited (*.csv),*.csv"

    With Application
        fileName = .GetOpenFilename(Title:=iTitle, _
                                    filefilter:=FilterList, _
                                    FilterIndex:=1)
    End With
    If fileName = "False" Then
        Exit Sub
    End If

End Sub

Jeff Armstrong
Sr. Systems Mgr
SBC Services, Inc.
__________________
Jeff Armstrong
Sr. Systems Mgr
SBC Services, Inc.
 
Old January 14th, 2005, 03:52 AM
Authorized User
 
Join Date: Jan 2005
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try the following command just before fileName = .GetOpenFilename(

ChDir "your Path"

I am not sure, but it should work!








Similar Threads
Thread Thread Starter Forum Replies Last Post
Open dialog box... hooking shikhar_ntd Visual C++ 0 April 13th, 2006 12:25 AM
open file dialog box mh VB.NET 7 April 11th, 2005 10:15 AM
Open File Dialog Box KennethMungwira VB.NET 3 August 3rd, 2003 09:44 PM
Open directory dialog box mkpriya VS.NET 2002/2003 6 July 2nd, 2003 07:24 AM
Open File Dialog Box KennethMungwira VB.NET 2 June 27th, 2003 04:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.