Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
get a folder name
i am using the following code for getting user input for a folder name.
i got this code from a book. it works well but how do i get the complete path of the folder assigned to a string variable? like "UserFile" With Application.FileDialog(msoFileDialogFolderPicker) .InitialFileName = Application.DefaultFilePath & "\" .Title = "Please select a location for saving the Work Request" .Show If .SelectedItems.Count = 0 Then MsgBox "Location to save WR not selected" Else MsgBox .SelectedItems(1) End If UserFile = SelectedItems.Value 'is this right? End With |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
get a folder name
Hi,
You already had the answer in your code, try this With Application.FileDialog(msoFileDialogFolderPicker) .InitialFileName = Application.DefaultFilePath & "\" .Title = "Please select a location for saving the Work Request" .Show If .SelectedItems.Count = 0 Then MsgBox "Location to save WR not selected" Else MsgBox .SelectedItems(1) UserFile = .SelectedItems(1) 'is this right? No but this is End If End With Mike "linto" wrote: i am using the following code for getting user input for a folder name. i got this code from a book. it works well but how do i get the complete path of the folder assigned to a string variable? like "UserFile" With Application.FileDialog(msoFileDialogFolderPicker) .InitialFileName = Application.DefaultFilePath & "\" .Title = "Please select a location for saving the Work Request" .Show If .SelectedItems.Count = 0 Then MsgBox "Location to save WR not selected" Else MsgBox .SelectedItems(1) End If UserFile = SelectedItems.Value 'is this right? End With |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
get a folder name
thanks mike
"Mike H" wrote: Hi, You already had the answer in your code, try this With Application.FileDialog(msoFileDialogFolderPicker) .InitialFileName = Application.DefaultFilePath & "\" .Title = "Please select a location for saving the Work Request" .Show If .SelectedItems.Count = 0 Then MsgBox "Location to save WR not selected" Else MsgBox .SelectedItems(1) UserFile = .SelectedItems(1) 'is this right? No but this is End If End With Mike "linto" wrote: i am using the following code for getting user input for a folder name. i got this code from a book. it works well but how do i get the complete path of the folder assigned to a string variable? like "UserFile" With Application.FileDialog(msoFileDialogFolderPicker) .InitialFileName = Application.DefaultFilePath & "\" .Title = "Please select a location for saving the Work Request" .Show If .SelectedItems.Count = 0 Then MsgBox "Location to save WR not selected" Else MsgBox .SelectedItems(1) End If UserFile = SelectedItems.Value 'is this right? End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pulling pdf files from general folder to specific folder | Excel Discussion (Misc queries) | |||
how can i change my default working folder to a networked folder? | Excel Discussion (Misc queries) | |||
How to decide folder-depth or How to select more folders/subfolders (folder-tree) ? | Excel Discussion (Misc queries) | |||
Need code to save file to new folder, erase from old folder | Excel Discussion (Misc queries) | |||
how can I specific a folder with wildcard criteria and excel will import all the correct files in that folder? | Excel Discussion (Misc queries) |