VBA Dim as string - How to use a cell value

RJSIGKITS

Board Regular
Joined
Apr 15, 2013
Messages
109
I'm trying to create a button that opens a specific folder path, dependant on the value in a cell on a specific workbook...
So, I have my file path, which I will use as 'Dim name1 As String', which is easy enough, but I want to include the value of the cell on the end of that to open a specific folder which has the same name as that cells value...

It's sort of like, I have folders named by clients surname+phone number (eg, SMITH289082) so, to find it, we would type SMITH289082 into the cell, then click the button to open the folder named 'SMITH289082'.

Should be simple enough..

So far I've got:
Code:
Private Sub CommandButton18_Click()Dim name1 As String
Dim client1 As String
name1 = "C:\Users\Richard\Box Sync\Default Sync Folder\1. *******s\2 CLIENTS\"
Call Shell("explorer.exe " & name1, vbNormalFocus)
End Sub

Please help - cheers!
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
It's all good! - I've done it!!

Code:
Private Sub CommandButton18_Click()Dim name1 As String
Dim client1 As String
name1 = "C:\Users\Richard\Box Sync\Default Sync Folder\1. *******s\2 CLIENTS\"
client1 = Range("C10")
Call Shell("explorer.exe " & name1 & client1, vbNormalFocus)
End Sub
 
Upvote 0

Forum statistics

Threads
1,217,382
Messages
6,136,238
Members
450,000
Latest member
jgp19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top