PC Review


Reply
Thread Tools Rate Thread

Assign a folder path to a variable

 
 
Fred
Guest
Posts: n/a
 
      15th Aug 2008
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

 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      15th Aug 2008
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
>

 
Reply With Quote
 
Fred
Guest
Posts: n/a
 
      18th Aug 2008
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
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add a large bulk of path into system path environment variable? gino Windows XP General 3 28th Jul 2004 07:30 PM
how to add a large bulk of path into system path environment variable? gino Windows XP Basics 3 28th Jul 2004 07:30 PM
how to add a large bulk of path into system path environment variable? gino Windows XP Help 3 28th Jul 2004 07:30 PM
how to add a large bulk of path into system path environment variable? gino Windows XP Setup 3 28th Jul 2004 07:30 PM
System path environment variable / truncated path =?Utf-8?B?TWlrZSBPJ05laWxs?= Microsoft Windows 2000 6 26th Nov 2003 10:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:47 PM.