ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selectfile control (https://www.excelbanter.com/excel-programming/307290-selectfile-control.html)

al ramirez

selectfile control
 
i need a control that will return a "path"
can i use a "selectfile" or another control in a form,
and how do i use it (an exemple will be greatly
appreciated) thanks in advance

Bob Flanagan

selectfile control
 
The example below will display the Windows directory dialog and let a user
select any directory. It will return the path to that directory.

Place this type declaration and the next two functions at
'the top of the module
Public Type BROWSEINFO
hWndOwner As Long
pidlRoot As Long
sDisplayName As String
sTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" _

(ByVal pidl As Long, ByVal pszPath As String) As Long

Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" _
(lpBrowseInfo As BROWSEINFO) As Long

Sub DemoGetPath()
Dim anyPath As String
anyPath = DirectoryName("Select destination folder")
If anyPath = "" Then
MsgBox "No directory selected"
Else
MsgBox anyPath
End If

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"al ramirez" wrote in message
...
i need a control that will return a "path"
can i use a "selectfile" or another control in a form,
and how do i use it (an exemple will be greatly
appreciated) thanks in advance




Tom Ogilvy

selectfile control
 
http://j-walk.com/ss/excel/tips/tip29.htm
Selecting a Directory

John Walkenbach's site

--
Regards,
Tom Ogilvy


"al ramirez" wrote in message
...
i need a control that will return a "path"
can i use a "selectfile" or another control in a form,
and how do i use it (an exemple will be greatly
appreciated) thanks in advance




al ramirez

selectfile control
 
Thanks Bob but:
DirectoryName("Select destination folder") is not defined,
how do I use it, and what those 2 functions do?, can you
elaborate a little bit more?. I'm a beginer.
thanks again. Al

-----Original Message-----
The example below will display the Windows directory

dialog and let a user
select any directory. It will return the path to that

directory.

Place this type declaration and the next two functions at
'the top of the module
Public Type BROWSEINFO
hWndOwner As Long
pidlRoot As Long
sDisplayName As String
sTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" _

(ByVal pidl As Long, ByVal pszPath As String) As Long

Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" _
(lpBrowseInfo As BROWSEINFO) As Long

Sub DemoGetPath()
Dim anyPath As String
anyPath = DirectoryName("Select destination folder")
If anyPath = "" Then
MsgBox "No directory selected"
Else
MsgBox anyPath
End If

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros

for Excel


"al ramirez" wrote in

message
...
i need a control that will return a "path"
can i use a "selectfile" or another control in a form,
and how do i use it (an exemple will be greatly
appreciated) thanks in advance



.


Tom Ogilvy

selectfile control
 
If you want the approach explained, with a complete example, then you might
check the link I provided.

--
Regards,
Tom Ogilvy


"al ramirez" wrote in message
...
Thanks Bob but:
DirectoryName("Select destination folder") is not defined,
how do I use it, and what those 2 functions do?, can you
elaborate a little bit more?. I'm a beginer.
thanks again. Al

-----Original Message-----
The example below will display the Windows directory

dialog and let a user
select any directory. It will return the path to that

directory.

Place this type declaration and the next two functions at
'the top of the module
Public Type BROWSEINFO
hWndOwner As Long
pidlRoot As Long
sDisplayName As String
sTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type

Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" _

(ByVal pidl As Long, ByVal pszPath As String) As Long

Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" _
(lpBrowseInfo As BROWSEINFO) As Long

Sub DemoGetPath()
Dim anyPath As String
anyPath = DirectoryName("Select destination folder")
If anyPath = "" Then
MsgBox "No directory selected"
Else
MsgBox anyPath
End If

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros

for Excel


"al ramirez" wrote in

message
...
i need a control that will return a "path"
can i use a "selectfile" or another control in a form,
and how do i use it (an exemple will be greatly
appreciated) thanks in advance



.




No Name

selectfile control
 
Tom:
Thank you very very much, indeed !!
Al

-----Original Message-----
http://j-walk.com/ss/excel/tips/tip29.htm
Selecting a Directory

John Walkenbach's site

--
Regards,
Tom Ogilvy


"al ramirez" wrote in

message
...
i need a control that will return a "path"
can i use a "selectfile" or another control in a form,
and how do i use it (an exemple will be greatly
appreciated) thanks in advance



.



All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com