VBA 6.0 GetOpenFilename

P

peterbrun

Hi all

I have a question to Excel VBA.

I am using the GetOpenFilename application to open the "open file"
browser. It automatically starts browsing the last place I have saved
or downloaded a file. I am using the GetOpenFilename in the following
way:

fileToOpen = Application.GetOpenFilename("Inflow Files (*.flo),
*.flo,All Files (*.*), *.*")

My question is:

How do I specify the path for where I wan't to browse from? Is it
Application.path??? something I have to change before I run the
GetOpenFilename command?

Any help appreciated.

Regards
Brun
 
N

NickHK

Brun,
You can use ChDrive/ChDir before the call to .GetOpenFilename to point to
the desired location.

NickHK
 
P

peterbrun

Brun,
You can use ChDrive/ChDir before the call to .GetOpenFilename to point to
the desired location.

NickHK













- Vis tekst i anførselstegn -

Off cause. Works perfect. Thankyou.

Brun
 
C

Chip Pearson

I would recommend that you respect the user's settings and restore the
Current Directory after the GetOpenFilename

Dim OldDir As String
Dim FName As Variant
OldDir = CurDir
ChDrive "C:\Test"
ChDir "C:\Test"
FName =Aplication.GetOpenFilename(....)
ChDrive OldDir
ChDir OldDir


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

Brun,
You can use ChDrive/ChDir before the call to .GetOpenFilename to point to
the desired location.

NickHK













- Vis tekst i anførselstegn -

Off cause. Works perfect. Thankyou.

Brun
 
P

peterbrun

Hi Chip.

Good idea. I will do that.

Peter

I would recommend that you respect the user's settings and restore the
Current Directory after theGetOpenFilename

Dim OldDir As String
Dim FName As Variant
OldDir = CurDir
ChDrive "C:\Test"
ChDir "C:\Test"
FName =Aplication.GetOpenFilename(....)
ChDrive OldDir
ChDir OldDir

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLCwww.cpearson.com
(email address is on the web site)





Off cause. Works perfect. Thankyou.

Brun- Skjul tekst i anførselstegn -

- Vis tekst i anførselstegn -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top