Reputation: 1284
I have a problem with passing values. First of I tried to passing them between Userform and module. I thought it must have been an issue so I put subroutine in the same userform. Still my value is passed but it does not pass back to the first subroutine. I am getting lost what is happening...
Private Sub rob_wnioski_but_Click()
Dim wnioski_path As String
wybor_pliku klient_path:="", opcja:=1
MsgBox (klient_path)
End Sub
Private Sub wybor_pliku(ByRef klient_path As String, opcja As Integer)
Start.Hide
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False 'tylko jeden plik
If .Show = True Then: klient_path = .SelectedItems(1)
End With
Unload Start
End Sub
Upvotes: 1
Views: 305
Reputation: 2825
You need to pass a variable to wybor_pliku. What you are doing is to pass a literal (empty string). You need to declare klient_path as a variable in the _Click procedure, then call wybor_pliku like this:
wybor_pliku klient_path, opcja:=1
Upvotes: 2