ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileDialog question (https://www.excelbanter.com/excel-programming/397289-filedialog-question.html)

LeAnn

FileDialog question
 
I have the following code:

Dim fd As FileDialog
Dim strDir As String
strDir = "\\my network path\"
Set fd = Application.FileDialog(msoFileDialogOpen)
fd.Show
fd.InitialFileName = strDir

When I click on the button that calls the code it opens the default file
location. If I click it again it will go to the designated directory. What
am I doing wrong?

Thanks
LeAnn

RB Smissaert

FileDialog question
 
Try this:

strDir = "\\my network path\"
ChDir strDir


RBS

"LeAnn" wrote in message
...
I have the following code:

Dim fd As FileDialog
Dim strDir As String
strDir = "\\my network path\"
Set fd = Application.FileDialog(msoFileDialogOpen)
fd.Show
fd.InitialFileName = strDir

When I click on the button that calls the code it opens the default file
location. If I click it again it will go to the designated directory.
What
am I doing wrong?

Thanks
LeAnn



Elceller in distress[_2_]

FileDialog question
 
Try moving the fd.show after the fd.initalfile name statement.

fd.InitialFileName = strDir
fd.Show




"LeAnn" wrote:

I have the following code:

Dim fd As FileDialog
Dim strDir As String
strDir = "\\my network path\"
Set fd = Application.FileDialog(msoFileDialogOpen)
fd.Show
fd.InitialFileName = strDir

When I click on the button that calls the code it opens the default file
location. If I click it again it will go to the designated directory. What
am I doing wrong?

Thanks
LeAnn


RB Smissaert

FileDialog question
 
Yes that is better, didn't spot that one.

RBS


"Elceller in distress" wrote
in message ...
Try moving the fd.show after the fd.initalfile name statement.

fd.InitialFileName = strDir
fd.Show




"LeAnn" wrote:

I have the following code:

Dim fd As FileDialog
Dim strDir As String
strDir = "\\my network path\"
Set fd = Application.FileDialog(msoFileDialogOpen)
fd.Show
fd.InitialFileName = strDir

When I click on the button that calls the code it opens the default file
location. If I click it again it will go to the designated directory.
What
am I doing wrong?

Thanks
LeAnn



LeAnn

FileDialog question
 
Perfect thanks!

"Elceller in distress" wrote:

Try moving the fd.show after the fd.initalfile name statement.

fd.InitialFileName = strDir
fd.Show




"LeAnn" wrote:

I have the following code:

Dim fd As FileDialog
Dim strDir As String
strDir = "\\my network path\"
Set fd = Application.FileDialog(msoFileDialogOpen)
fd.Show
fd.InitialFileName = strDir

When I click on the button that calls the code it opens the default file
location. If I click it again it will go to the designated directory. What
am I doing wrong?

Thanks
LeAnn



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com