Problem with path visual basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kosmous
    New Member
    • Feb 2010
    • 4

    Problem with path visual basic

    Hi,

    i'm new with visual basic.
    My problem is the following :

    According to the code i have attached,
    i use two buttons,
    when i press the BUTTON1, opens Browse Folder, i select the drive where i store files and i want to use the path that i have just selected. For this reason i transfer the path to another variable named: PATH

    When i use the variable PATH to another function (BUTTON2) it seems like the variable KM has no value. Error message : "Path not found"

    How can i use the variable PATH to the other function ?

    Hope somebody can help me,
    Thank you
    -------------------------------------------------------------------------------------
    Private Sub BUTTON1_Click()

    Dim KM As String
    Dim PATH As String

    KM = BrowseForFolder (hwnd, "Please select a folder.")

    If KM = "" Then
    Call MsgBox("The Cancel button was pressed.", vbExclamation)
    Else
    Call MsgBox("The folder " & KM & " was selected.", vbExclamation)
    PATH = KM

    End If

    End Sub
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    Declare the path variable in the general declarations section of the form/module because presently, its scope is only the sub in which it was declared in...



    Good Luck

    Comment

    • kosmous
      New Member
      • Feb 2010
      • 4

      #3
      Thank you

      for the quick response, i'll try your suggestion !!
      You are right !

      Comment

      Working...