Link to a specific Subfolder Name located in a specific Folder Name (1 Viewer)

dim1962

Registered User.
Local time
Today, 08:49
Joined
Mar 24, 2009
Messages
15
Hi All

I’m not a specialist to right a code in VBA. Please help me!
I have a form with two fields A and B. I created a button to open a specific Subfolder S (Sx until Sy) located in a specific Folder F (Fx until Fy).
Example: If the field A = F5 and the field B = S10, pressing on the button I have to open the Path: P:\F5\S10
I tried to use this code:

Dim strFoldername As String
Dim strSubfoldername As String

strFoldername = Me.A
strSubfoldername = Me.B

FollowHyperlink C:\strFoldername\strSubfoldername

Something is wrong and doesn’t work.
In the same time, if is possible, I like to add an If statement.
If the subfolder doesn’t exist then,
Msgbox confirmation, create the respective subfolder name and open it.
The something for the folder level:
Msgbox confirmation, create the respective folder name and open it.

Can you help me?
Thanks
 

boblarson

Smeghead
Local time
Today, 05:49
Joined
Jan 12, 2001
Messages
32,059
This is incorrect syntax:
FollowHyperlink C:\strFoldername\strSubfoldername

You need to concatenate into a string:

FollowHyperlink "C:\" & strFoldername & "\" & strSubfolderName
 

dim1962

Registered User.
Local time
Today, 08:49
Joined
Mar 24, 2009
Messages
15
Thanks a lot.
Is good now!
 

boblarson

Smeghead
Local time
Today, 05:49
Joined
Jan 12, 2001
Messages
32,059
Thanks a lot.
Is good now!

 

Users who are viewing this thread

Top Bottom