I tought this would be easy, but I'm bumping on a wall:
I can now open a specific file on my computer, based on fields firstname and lastname (thanks to the forum's help) .
Now I'm trying to open the map (which holds all client's related files, so in my case the one that stands above the .txt file). It doesn't work, nor with Shell, nor with Followhyperlink.
-------------
Here are the two codes I tried:
1) Shell explorer.exe:
Private Sub Command282_Click()
On Error GoTo Err_Knop282_Click
Dim Foldername As String
Dim stnaamfile As String
stnaamfile = Me.ACHTERNAAM & "" & Me.VOORNAAM
Dim LResult As String
LResult = LCase("stnaamfile")
Foldername = "\\server\c:\Users\eigenaar\Documents" & stnaamfile & "\"
Shell "C:\WINDOWS\explorer.exe """ & Foldername & "", vbNormalFocus
Exit_Knop282_Click:
Exit Sub
Err_Knop282_Click:
MsgBox Err.Description
Resume Exit_Knop282_Click
End Sub
____________________
2) the one with Followhyperlink
Private Sub Command282_Click()
On Error GoTo Err_Knop282_Click
Dim Foldername As String
Dim stnaamfile As String
stnaamfile = Me.ACHTERNAAM & "" & Me.VOORNAAM
Dim LResult As String
LResult = LCase("stnaamfile")
Foldername = "\\server\c:\Users\eigenaar\Document" & stnaamfile
Application.FollowHyperlink Foldername
Exit_Knop282_Click:
Exit Sub
Err_Knop282_Click:
MsgBox Err.Description
Resume Exit_Knop282_Click
End Sub
------------------------------------
All I'm opening is the 'Document' file (which stands for 'my documents').
It doesn't go any further, no matter what I change.
I cannot get vba to comprehend the 'stnaamfile' .
Can anyone give me a suggestion of what I'm doing wrong?
I can now open a specific file on my computer, based on fields firstname and lastname (thanks to the forum's help) .
Now I'm trying to open the map (which holds all client's related files, so in my case the one that stands above the .txt file). It doesn't work, nor with Shell, nor with Followhyperlink.
-------------
Here are the two codes I tried:
1) Shell explorer.exe:
Private Sub Command282_Click()
On Error GoTo Err_Knop282_Click
Dim Foldername As String
Dim stnaamfile As String
stnaamfile = Me.ACHTERNAAM & "" & Me.VOORNAAM
Dim LResult As String
LResult = LCase("stnaamfile")
Foldername = "\\server\c:\Users\eigenaar\Documents" & stnaamfile & "\"
Shell "C:\WINDOWS\explorer.exe """ & Foldername & "", vbNormalFocus
Exit_Knop282_Click:
Exit Sub
Err_Knop282_Click:
MsgBox Err.Description
Resume Exit_Knop282_Click
End Sub
____________________
2) the one with Followhyperlink
Private Sub Command282_Click()
On Error GoTo Err_Knop282_Click
Dim Foldername As String
Dim stnaamfile As String
stnaamfile = Me.ACHTERNAAM & "" & Me.VOORNAAM
Dim LResult As String
LResult = LCase("stnaamfile")
Foldername = "\\server\c:\Users\eigenaar\Document" & stnaamfile
Application.FollowHyperlink Foldername
Exit_Knop282_Click:
Exit Sub
Err_Knop282_Click:
MsgBox Err.Description
Resume Exit_Knop282_Click
End Sub
------------------------------------
All I'm opening is the 'Document' file (which stands for 'my documents').
It doesn't go any further, no matter what I change.
I cannot get vba to comprehend the 'stnaamfile' .
Can anyone give me a suggestion of what I'm doing wrong?