Excel Hyperlinks save Filename

  Hobblenobble 20:33 07 Nov 2009

I have a list of hyperlinks in a column in excel 2007. The hyperlink names are incremented by one i.e. ABB01, ABB02, ABB03. Each of the hyperlinks goes to the same template. I would like to know how to save the template with the same name for the hyperlink that was used to open it. Thank you.

  VoG II 22:02 07 Nov 2009

I imagine something like this. Right click the sheet tab, select View code and paste in

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
ThisWorkbook.SaveAs Filename:=Target & ".xls"
End Sub

then press ALT + Q to return to your sheet.

  Hobblenobble 22:20 07 Nov 2009

Thanks for the quick response. I copied and pasted the code into the template View code, saved. But the saved name was still the same for the template which is 'Blank'.

Ideally I would be able to hyperlink to the template and click on a button which will save the template to the same name as the hyperlink.

Any help would be more than appreciated.

Thank you.

  VoG II 09:17 08 Nov 2009


Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
ThisWorkbook.SaveAs Filename:=Target.TextToDisplay & ".xls"
End Sub

  Hobblenobble 10:02 08 Nov 2009

VoG, thanks once again. I dont seem to be able to achieve what I want. I do not know if I am doing it correclty. The code has been inserted in the view code of the template. When the template is opened from a hyperlink, it is still saved as its original template name of 'Blank'.

  VoG II 10:15 08 Nov 2009

This worked for me when I tested it

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
ActiveWorkbook.SaveAs Filename:=Target.TextToDisplay & ".xlsx"
End Sub

  Hobblenobble 10:22 08 Nov 2009

VoG, would it be easier/better to open a template and then save it sequentially in a folder?

  Hobblenobble 10:29 08 Nov 2009

VoG, I have only a small brain cell to use!!!!!
Was I correct in inserting the code in the view code tab in the template file, then file, saveas then ok?

You make it sound sooo simple......... it probably is.

  VoG II 10:35 08 Nov 2009

The code should go in the code module for the sheet that contains the hyperlinks. Then when you click on a hyperlink on that sheet the hyperlinked file will be opened and saved with the text displayed in the hyperlink (in the same folder as the file that contains the sheet with the hyperlinks).

  Hobblenobble 10:57 08 Nov 2009

It was me! That works an absolute treat. I thank you for your knowledge,time and patience.

Many thanks.


This thread is now locked and can not be replied to.

Elsewhere on IDG sites

OnePlus 5 review

Alice Saey's mesmerising animation for Dutch singer Mark Lotterman

iPad Pro 10.5in (2017) review

Comment booster votre iPhone ?