title: VB 6.0, take input from user and open a folder
body: <p>i want to take 2 input from user and open folder</p>
  
  <p>Suppose we have several  directory  like G:\s\ABC-123\XYZ-001 
  i want to take 2 input from user where user will give input of 123 and 001 in different textbox and folder will open.
  G:\s\ABC-(string)\XYZ-(string)
  where string are the input from user.</p>
  
  <p>i have got this code on internet,can you guys help me with this.</p>
  
  <pre><code>Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  Function pathOfFile(fileName As String) As String
      Dim posn As Integer
      posn = InStrRev(fileName, "\")
      If posn &gt; 0 Then
          pathOfFile = Left$(fileName, posn)
      Else
          pathOfFile = ""
      End If
  End Function
  Private Sub Command1_Click()
      Dim myPath As String
      myPath = "D:\Dani\result.png"
      ShellExecute 0, vbNullString, pathOfFile(myPath), vbNullString, vbNullString, 1
  End Sub
  </code></pre>