![]() |
Assign a folder path to a variable
Hi
I'm trying to get the browseforfolder path assigned to a variable as I need to use that path later in other code. Here is what I have so far: Dim FolderName As String Application.FileDialog(msoFileDialogFolderPicker). InitialFileName = "H:\EFT\EFT Payments\2008\" 'Specify folder path If Application.FileDialog(msoFileDialogFolderPicker). Show = -1 Then Range("B40").Value = FolderName Else Range("B41").Value = "Don't do stuff" End If Where am I going wrong? Thanks Fred |
Assign a folder path to a variable
To get the name & path from the dialog:
Sub WhichTwo() Set x = Application.FileDialog(msoFileDialogFolderPicker) x.Show s = x.SelectedItems(1) MsgBox (s) End Sub -- Gary''s Student - gsnu200800 "Fred" wrote: Hi I'm trying to get the browseforfolder path assigned to a variable as I need to use that path later in other code. Here is what I have so far: Dim FolderName As String Application.FileDialog(msoFileDialogFolderPicker). InitialFileName = "H:\EFT\EFT Payments\2008\" 'Specify folder path If Application.FileDialog(msoFileDialogFolderPicker). Show = -1 Then Range("B40").Value = FolderName Else Range("B41").Value = "Don't do stuff" End If Where am I going wrong? Thanks Fred |
Assign a folder path to a variable
Thank you.
Fred "Gary''s Student" wrote: To get the name & path from the dialog: Sub WhichTwo() Set x = Application.FileDialog(msoFileDialogFolderPicker) x.Show s = x.SelectedItems(1) MsgBox (s) End Sub -- Gary''s Student - gsnu200800 "Fred" wrote: Hi I'm trying to get the browseforfolder path assigned to a variable as I need to use that path later in other code. Here is what I have so far: Dim FolderName As String Application.FileDialog(msoFileDialogFolderPicker). InitialFileName = "H:\EFT\EFT Payments\2008\" 'Specify folder path If Application.FileDialog(msoFileDialogFolderPicker). Show = -1 Then Range("B40").Value = FolderName Else Range("B41").Value = "Don't do stuff" End If Where am I going wrong? Thanks Fred |
All times are GMT +1. The time now is 05:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com