Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cmd Dialog Cancel Button?

Status
Not open for further replies.

kliz0328

Programmer
Nov 7, 2005
138
US
I have some code, that I got from this site, that allows a user to browse for a folder, the code is below. My question is, how do you determine whether the user has clicked the OK button, the Cancel button, or the close. "X" button?


Code:
fold = PickFolder(0)

Function PickFolder(strStartDir As Variant) As String
Dim SA As Object, F As Object
Set SA = CreateObject("Shell.Application")
Set F = SA.BrowseForFolder(0, "Choose a folder", 0)
If (Not F Is Nothing) Then
  PickFolder = F.Items.Item.path
End If
Set F = Nothing
Set SA = Nothing
End Function
 
I don't think I can do that, the browse for folder form is not a form that I created, and I can't get it into design view, the code above is all that it took to create it.
 
Oh I see... I am not familiar with the browse window.... but you can probably google it and find all the propertys...... try google with browse folder window attributes or something
 
Yes I am trying, I have been trying to tweak the F.Items.Iten.path statement from above to get something but no luck yet.
 
fold = PickFolder(0)
If fold = "" Then MsgBox "You didn't select a folder"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top