Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 26
Default FolderPicker dialog box

Using the FolderPicker (along with Microsoft Scripting Runtime), how do I
open the dialog box in a specific folder (say c:\temp)

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show
' ???? instruction for the dialog box to open in c:\temp
End With

Regards

Michel


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default FolderPicker dialog box

How about:

Option Explicit
Sub testme01()
Dim fd As FileDialog
Dim curFolder As String
Dim newFolder As String

newFolder = "C:\temp"

curFolder = CurDir

ChDir newFolder
ChDrive newFolder

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show
End With

ChDir curFolder
ChDrive curFolder
End Sub

MD wrote:

Using the FolderPicker (along with Microsoft Scripting Runtime), how do I
open the dialog box in a specific folder (say c:\temp)

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show
' ???? instruction for the dialog box to open in c:\temp
End With

Regards

Michel


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 26
Default FolderPicker dialog box

This is strange.... I used your exemple... and It worked(only one time) I
modified the value of "newFolder" to D:\temp and it still gave me C:\temp
?? I close the workbook (but kept EXCEL open)... same thing...... I closed
EXCEL all together and it now worked.

It seems that changing the value of newFolder is tricky. Say you want to
add "IF" this then newfolder X value "IF" that then newfolderYvalue

Option Explicit
Sub testme01()
Dim fd As FileDialog
Dim curFolder As String
Dim newFolder As String

newFolder = "C:\temp"

curFolder = CurDir

ChDir newFolder
ChDrive newFolder

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show
End With

ChDir curFolder
ChDrive curFolder
End Sub...????


"Dave Peterson" a écrit dans le message de
...
How about:

Option Explicit
Sub testme01()
Dim fd As FileDialog
Dim curFolder As String
Dim newFolder As String

newFolder = "C:\temp"

curFolder = CurDir

ChDir newFolder
ChDrive newFolder

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show
End With

ChDir curFolder
ChDrive curFolder
End Sub

MD wrote:

Using the FolderPicker (along with Microsoft Scripting Runtime), how do

I
open the dialog box in a specific folder (say c:\temp)

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show
' ???? instruction for the dialog box to open in c:\temp
End With

Regards

Michel


--

Dave Peterson



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default FolderPicker dialog box

It worked ok the ONE time I tested.

But I couldn't get it to change initial folders.

Maybe you could use Jim Rech's BrowseForFolder.zip at:
http://www.bmsltd.ie/MVP/Default.htm


MD wrote:

This is strange.... I used your exemple... and It worked(only one time) I
modified the value of "newFolder" to D:\temp and it still gave me C:\temp
?? I close the workbook (but kept EXCEL open)... same thing...... I closed
EXCEL all together and it now worked.

It seems that changing the value of newFolder is tricky. Say you want to
add "IF" this then newfolder X value "IF" that then newfolderYvalue

Option Explicit
Sub testme01()
Dim fd As FileDialog
Dim curFolder As String
Dim newFolder As String

newFolder = "C:\temp"

curFolder = CurDir

ChDir newFolder
ChDrive newFolder

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show
End With

ChDir curFolder
ChDrive curFolder
End Sub...????

"Dave Peterson" a écrit dans le message de
...
How about:

Option Explicit
Sub testme01()
Dim fd As FileDialog
Dim curFolder As String
Dim newFolder As String

newFolder = "C:\temp"

curFolder = CurDir

ChDir newFolder
ChDrive newFolder

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show
End With

ChDir curFolder
ChDrive curFolder
End Sub

MD wrote:

Using the FolderPicker (along with Microsoft Scripting Runtime), how do

I
open the dialog box in a specific folder (say c:\temp)

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show
' ???? instruction for the dialog box to open in c:\temp
End With

Regards

Michel


--

Dave Peterson


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default FolderPicker dialog box

Try following:

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
fd.InitialFileName = "c:\temp"
With fd
.Show
End With



Jan

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default FolderPicker dialog box

In win98/xl2002, I had to use:
fd.InitialFileName = "c:\temp\"

And to keep it from making it the current directory:

Option Explicit
Sub testme01()
Dim fd As FileDialog
Dim curFolder As String
Dim newFolder As String

newFolder = "C:\temp\"

curFolder = CurDir

ChDir newFolder
ChDrive newFolder

Set fd = Application.FileDialog(msoFileDialogFolderPicker)

With fd
.InitialFileName = newFolder
.Show
End With

ChDir curFolder
ChDrive curFolder
End Sub

(Thanks for posting the solution, w0rm.)



"w0rm <" wrote:

Try following:

Set fd = Application.FileDialog(msoFileDialogFolderPicker)
fd.InitialFileName = "c:\temp"
With fd
Show
End With

Jani

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

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
How to delete the "Insert Function Dialog Box" (dialog box only)? TBI''d biker Excel Worksheet Functions 2 April 7th 07 09:18 PM
Use of Dialog markuss New Users to Excel 4 June 24th 06 02:13 AM
dialog box alm09 Excel Discussion (Misc queries) 1 March 31st 06 05:50 PM
control of dialog macro dialog box. on open Gerry Abbott Excel Programming 0 July 22nd 04 05:41 PM
VBA for Dialog Box Gary[_5_] Excel Programming 1 July 15th 03 05:30 PM


All times are GMT +1. The time now is 02:07 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"