Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My code is below. Very simple, the users to select a directory and I'd like
to pick up where this has been previously set. This all works, it picksup the directory, it changes the CurDir and msgbox it back all fine. Then the next stage is the file browse dialog and is using somewhere else again ! How can I set or control where the FileDialog(msoFileDialogFolderPicker) starts the default view from ? TIA Public OldDir As String Public ArchiveDir As String Sub UseFileDialogOpen() 'Pick Up Current Directory OldDir = CurDir 'Pick up archive directory ArchiveDir = Sheets("Files").Range("B9").Value 'ArchiveDir = "C:\windows\" 'Test Archive Directory exists If Dir(ArchiveDir, vbDirectory) < "" Then 'If ArchiveDir Found ChDir ArchiveDir MsgBox CurDir End If ' Open the file dialog Set BrowseFolder = Application.FileDialog(msoFileDialogFolderPicker) With BrowseFolder .Show If BrowseFolder.SelectedItems.Count 0 Then Var = .SelectedItems(1) End If End With MsgBox Var End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To answer my own question as I was being silly... I need to set
..InitialFileName as per below and it works :) ' Open the file dialog Set BrowseFolder = Application.FileDialog(msoFileDialogFolderPicker) With BrowseFolder .InitialFileName = ArchiveDir .Show If BrowseFolder.SelectedItems.Count 0 Then Var = .SelectedItems(1) End If End With "nx3" wrote: My code is below. Very simple, the users to select a directory and I'd like to pick up where this has been previously set. This all works, it picksup the directory, it changes the CurDir and msgbox it back all fine. Then the next stage is the file browse dialog and is using somewhere else again ! How can I set or control where the FileDialog(msoFileDialogFolderPicker) starts the default view from ? TIA Public OldDir As String Public ArchiveDir As String Sub UseFileDialogOpen() 'Pick Up Current Directory OldDir = CurDir 'Pick up archive directory ArchiveDir = Sheets("Files").Range("B9").Value 'ArchiveDir = "C:\windows\" 'Test Archive Directory exists If Dir(ArchiveDir, vbDirectory) < "" Then 'If ArchiveDir Found ChDir ArchiveDir MsgBox CurDir End If ' Open the file dialog Set BrowseFolder = Application.FileDialog(msoFileDialogFolderPicker) With BrowseFolder .Show If BrowseFolder.SelectedItems.Count 0 Then Var = .SelectedItems(1) End If End With MsgBox Var End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Opening each file in a folder using msoFileDialogFolderPicker | Excel Discussion (Misc queries) | |||
Using Application.FileDialog(msoFileDialogFolderPicker) | Excel Discussion (Misc queries) | |||
FileDialog | Excel Programming | |||
using a filedialog box from a dll | Excel Programming | |||
FileDialog Help | Excel Programming |