Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CmK CmK is offline
external usenet poster
 
Posts: 69
Default FileDialog mso folder Picker

Hi

I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder


Thanks in Advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default FileDialog mso folder Picker

You can use the next level icon in this dialog box to move up to the folder
level, although it comes up at the file level.

Sub fndFle()
Application.Dialogs(xlDialogFindFile).Show
End Sub

"CmK" wrote:

Hi

I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder


Thanks in Advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default FileDialog mso folder Picker

Hi

Maybe Application.GetOpenFilename ?

Regards,
Per

On 13 Dec., 04:04, CmK wrote:
Hi

I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder

Thanks in Advance


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default FileDialog mso folder Picker

You can have the user pick a file, but return the folder it is in...
'--
Function GetMeAFolderOnly() As String
Dim fso As Object
Dim msg As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "C:\"
If .Show = -1 Then
msg = .SelectedItems(1)
Else
Exit Function
End If
End With

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(msg) Then
msg = fso.getparentfoldername(msg)
GetMeAFolderOnly = msg
Else
GetMeAFolderOnly = "Invalid"
End If
Set fso = Nothing
End Function
'--
'Call function...
Sub FolderName()
MsgBox GetMeAFolderOnly
End Sub
--
Jim Cone
Portland, Oregon USA
(thanks in advance is meaningless)


"CmK"
wrote in message
Hi
I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder
Thanks in Advance

  #5   Report Post  
Posted to microsoft.public.excel.programming
CmK CmK is offline
external usenet poster
 
Posts: 69
Default FileDialog mso folder Picker

So is the answer no ?it cant be done ?



"Jim Cone" wrote:

You can have the user pick a file, but return the folder it is in...
'--
Function GetMeAFolderOnly() As String
Dim fso As Object
Dim msg As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "C:\"
If .Show = -1 Then
msg = .SelectedItems(1)
Else
Exit Function
End If
End With

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(msg) Then
msg = fso.getparentfoldername(msg)
GetMeAFolderOnly = msg
Else
GetMeAFolderOnly = "Invalid"
End If
Set fso = Nothing
End Function
'--
'Call function...
Sub FolderName()
MsgBox GetMeAFolderOnly
End Sub
--
Jim Cone
Portland, Oregon USA
(thanks in advance is meaningless)


"CmK"
wrote in message
Hi
I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder
Thanks in Advance




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default FileDialog mso folder Picker

It can be done, but you are marching to a different drummer...

Sub ListenToMe()
MsgBox Get_Directory("Select a Folder"), , "Did You Hear the Drummer?"
End Sub
--

Function Get_Directory(ByRef strMessage As String) As String
On Error GoTo BadDirections
Dim objFF As Object
Set objFF = CreateObject("Shell.Application").BrowseForFolder _
(0, strMessage, &H4000, "c:\\")
If Not objFF Is Nothing Then
Get_Directory = objFF.items.Item.Path
Else
Get_Directory = vbNullString
End If
Set objFF = Nothing
Exit Function

BadDirections:
Set objFF = Nothing
Get_Directory = "Error Selecting a Folder"
End Function
'--

Jim Cone
Portland, Oregon USA




"CmK"
wrote in message
So is the answer no ?it cant be done ?



"Jim Cone" wrote:
You can have the user pick a file, but return the folder it is in...
'--
Function GetMeAFolderOnly() As String
Dim fso As Object
Dim msg As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "C:\"
If .Show = -1 Then
msg = .SelectedItems(1)
Else
Exit Function
End If
End With

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(msg) Then
msg = fso.getparentfoldername(msg)
GetMeAFolderOnly = msg
Else
GetMeAFolderOnly = "Invalid"
End If
Set fso = Nothing
End Function
'--
'Call function...
Sub FolderName()
MsgBox GetMeAFolderOnly
End Sub
--
Jim Cone
Portland, Oregon USA
(thanks in advance is meaningless)




"CmK"
wrote in message
Hi
I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder
Thanks in Advance

  #7   Report Post  
Posted to microsoft.public.excel.programming
CmK CmK is offline
external usenet poster
 
Posts: 69
Default FileDialog mso folder Picker


Thanks its works great now I have to figure how you did it

Thanks again


"Jim Cone" wrote:

It can be done, but you are marching to a different drummer...

Sub ListenToMe()
MsgBox Get_Directory("Select a Folder"), , "Did You Hear the Drummer?"
End Sub
--

Function Get_Directory(ByRef strMessage As String) As String
On Error GoTo BadDirections
Dim objFF As Object
Set objFF = CreateObject("Shell.Application").BrowseForFolder _
(0, strMessage, &H4000, "c:\\")
If Not objFF Is Nothing Then
Get_Directory = objFF.items.Item.Path
Else
Get_Directory = vbNullString
End If
Set objFF = Nothing
Exit Function

BadDirections:
Set objFF = Nothing
Get_Directory = "Error Selecting a Folder"
End Function
'--

Jim Cone
Portland, Oregon USA




"CmK"
wrote in message
So is the answer no ?it cant be done ?



"Jim Cone" wrote:
You can have the user pick a file, but return the folder it is in...
'--
Function GetMeAFolderOnly() As String
Dim fso As Object
Dim msg As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "C:\"
If .Show = -1 Then
msg = .SelectedItems(1)
Else
Exit Function
End If
End With

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(msg) Then
msg = fso.getparentfoldername(msg)
GetMeAFolderOnly = msg
Else
GetMeAFolderOnly = "Invalid"
End If
Set fso = Nothing
End Function
'--
'Call function...
Sub FolderName()
MsgBox GetMeAFolderOnly
End Sub
--
Jim Cone
Portland, Oregon USA
(thanks in advance is meaningless)




"CmK"
wrote in message
Hi
I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder
Thanks in Advance


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default FileDialog mso folder Picker


You are welcome.
( try replacing "c:\\" with "" )
--
Jim Cone
Portland, Oregon USA


"CmK"
wrote in message
Thanks its works great now I have to figure how you did it
Thanks again



"Jim Cone" wrote:
It can be done, but you are marching to a different drummer...

Sub ListenToMe()
MsgBox Get_Directory("Select a Folder"), , "Did You Hear the Drummer?"
End Sub
--

Function Get_Directory(ByRef strMessage As String) As String
On Error GoTo BadDirections
Dim objFF As Object
Set objFF = CreateObject("Shell.Application").BrowseForFolder _
(0, strMessage, &H4000, "c:\\")
If Not objFF Is Nothing Then
Get_Directory = objFF.items.Item.Path
Else
Get_Directory = vbNullString
End If
Set objFF = Nothing
Exit Function

BadDirections:
Set objFF = Nothing
Get_Directory = "Error Selecting a Folder"
End Function
'--

Jim Cone
Portland, Oregon USA




"CmK"
wrote in message
So is the answer no ?it cant be done ?



"Jim Cone" wrote:
You can have the user pick a file, but return the folder it is in...
'--
Function GetMeAFolderOnly() As String
Dim fso As Object
Dim msg As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "C:\"
If .Show = -1 Then
msg = .SelectedItems(1)
Else
Exit Function
End If
End With

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(msg) Then
msg = fso.getparentfoldername(msg)
GetMeAFolderOnly = msg
Else
GetMeAFolderOnly = "Invalid"
End If
Set fso = Nothing
End Function
'--
'Call function...
Sub FolderName()
MsgBox GetMeAFolderOnly
End Sub
--
Jim Cone
Portland, Oregon USA
(thanks in advance is meaningless)




"CmK"
wrote in message
Hi
I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder
Thanks in Advance

  #9   Report Post  
Posted to microsoft.public.excel.programming
CmK CmK is offline
external usenet poster
 
Posts: 69
Default FileDialog mso folder Picker


Doesn't it just default to Desktop?

"Jim Cone" wrote:


You are welcome.
( try replacing "c:\\" with "" )
--
Jim Cone
Portland, Oregon USA


"CmK"
wrote in message
Thanks its works great now I have to figure how you did it
Thanks again



"Jim Cone" wrote:
It can be done, but you are marching to a different drummer...

Sub ListenToMe()
MsgBox Get_Directory("Select a Folder"), , "Did You Hear the Drummer?"
End Sub
--

Function Get_Directory(ByRef strMessage As String) As String
On Error GoTo BadDirections
Dim objFF As Object
Set objFF = CreateObject("Shell.Application").BrowseForFolder _
(0, strMessage, &H4000, "c:\\")
If Not objFF Is Nothing Then
Get_Directory = objFF.items.Item.Path
Else
Get_Directory = vbNullString
End If
Set objFF = Nothing
Exit Function

BadDirections:
Set objFF = Nothing
Get_Directory = "Error Selecting a Folder"
End Function
'--

Jim Cone
Portland, Oregon USA




"CmK"
wrote in message
So is the answer no ?it cant be done ?



"Jim Cone" wrote:
You can have the user pick a file, but return the folder it is in...
'--
Function GetMeAFolderOnly() As String
Dim fso As Object
Dim msg As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "C:\"
If .Show = -1 Then
msg = .SelectedItems(1)
Else
Exit Function
End If
End With

Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(msg) Then
msg = fso.getparentfoldername(msg)
GetMeAFolderOnly = msg
Else
GetMeAFolderOnly = "Invalid"
End If
Set fso = Nothing
End Function
'--
'Call function...
Sub FolderName()
MsgBox GetMeAFolderOnly
End Sub
--
Jim Cone
Portland, Oregon USA
(thanks in advance is meaningless)




"CmK"
wrote in message
Hi
I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder
Thanks in Advance


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default FileDialog mso folder Picker


Yes, that what my tests show for an invalid drive designation.
However, c: or c:\ on my system will display that drive.



"CmK"
wrote in message
Doesn't it just default to Desktop?




"Jim Cone" wrote:
You are welcome.
( try replacing "c:\\" with "" )
--
Jim Cone
Portland, Oregon USA




  #11   Report Post  
Posted to microsoft.public.excel.programming
CmK CmK is offline
external usenet poster
 
Posts: 69
Default FileDialog mso folder Picker

HI

Isn't desktop a normal folder why the object return error when i select it

"Jim Cone" wrote:


Yes, that what my tests show for an invalid drive designation.
However, c: or c:\ on my system will display that drive.



"CmK"
wrote in message
Doesn't it just default to Desktop?




"Jim Cone" wrote:
You are welcome.
( try replacing "c:\\" with "" )
--
Jim Cone
Portland, Oregon USA



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default FileDialog mso folder Picker


The display and what is returned differs with the
settings and the Windows operating system.
It marches to a different drummer. <g
--
Jim Cone
Portland, Oregon USA


"CmK"
wrote in message
HI
Isn't desktop a normal folder why the object return error when i select it



"Jim Cone" wrote:
Yes, that what my tests show for an invalid drive designation.
However, c: or c:\ on my system will display that drive.



"CmK"
wrote in message
Doesn't it just default to Desktop?




"Jim Cone" wrote:
You are welcome.
( try replacing "c:\\" with "" )
--
Jim Cone
Portland, Oregon USA



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
Is there a Folder Picker method that shows files too? tenlbham Excel Programming 10 January 11th 08 11:55 PM
How can I clean the buffer from the folder picker? Excel 009 Excel Programming 22 October 3rd 06 04:22 PM
FileDialog Folder selection spec Alan Excel Programming 4 February 21st 04 04:41 AM
Folder picker default - second attempt... pk Excel Programming 4 October 13th 03 05:42 PM
Folder picker: default to network share? pk Excel Programming 0 October 11th 03 04:48 PM


All times are GMT +1. The time now is 05:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"