Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Hyperlink to drive

1

Hi,

I want to hyperlink a command button to "C:\Users\dbuckley\Desktop\Machinery Register\(EXCEL_SHEET_NAME)\drawings"

The excel_sheet_name is a templete so the sheet and folder when created will have matching names.

So the name of the excel sheet and folders will always be changing.

Answer
Discuss

Discussion

Please don't forget to select the answer that worked best for you! Just click the Select Answer button at the bottom of the desired answer.
don (rep: 1989) Jul 2, '17 at 11:46 am
Add to Discussion

Answers

0
Selected Answer
=HYPERLINK("C:\Users\dbuckley\Desktop\Machinery Register\" & MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255) & "\drawings","Link")

This is the part that gets the sheet name:

MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)

Update

Per your new request, this is the macro that will do it:

Sub open_workbook()

Workbooks.Open ("C:\Users\dbuckley\Desktop\Machinery Register\" & ActiveSheet.Name & "\drawings")

End Sub

Attach it to a button by right-clicking the button and clicking Assign Macro...

Discuss

Discussion

Thank you this works very well. Can I just ask one extra pieces of information.

Can I get this to work as a Macro? using a command button?

Thanks
Dambuckles (rep: 4) Jun 27, '17 at 6:59 pm
Answer updated
don (rep: 1989) Jun 28, '17 at 9:22 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login