BarraPippo
New Member
Hello all,
i need help with a VBA code. Dont know what im doing wrong
I have an excel sheet and would like a button that when clicked it opens a specific folder, named as the excel sheet i'm clicking the button from
I have a sheet, name 085 - I click the button, the macro starts and it opens a folder in a specific directory named 085
The number 085 which names the sheet is from the Range(Q16)
This is where i am so far. It only opens the MainDesktop although i already have a subfolder in the Desktop named 085
>>> use code - tags <<<
Thanks in advance
i need help with a VBA code. Dont know what im doing wrong
I have an excel sheet and would like a button that when clicked it opens a specific folder, named as the excel sheet i'm clicking the button from
I have a sheet, name 085 - I click the button, the macro starts and it opens a folder in a specific directory named 085
The number 085 which names the sheet is from the Range(Q16)
This is where i am so far. It only opens the MainDesktop although i already have a subfolder in the Desktop named 085
>>> use code - tags <<<
Code:
Sub Open_Folder()
Const MainFolder As String = "C:\Users\filip\Desktop"
Dim Foldername As String, MyFolder As String
MyFolder = ActiveSheet.Range("Q16")
Foldername = Dir(MainFolder & MyFolder & "*", vbDirectory)
Shell "C:\WINDOWS\explorer.exe """ & MainFolder & Foldername & """", vbNormalFocus
End Sub
Thanks in advance