Question Locked

VBA code/variable? for filename

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello,

I created a macro what makes in a cell a hyperlink of the filename and the path and copy the link to the clipboard. It works, i made a template of it and put it in XLstart "normal.xlsm". Now if i open excel and i make a new filename and save it on the place i want because of changing the name the macro won't work anymore, here's the code:

Application.Run "normal.xlsm!Filename"
Application.CutCopyMode = False
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
ActiveWorkbook.FullName, TextToDisplay:= _
ActiveWorkbook.FullName
If i want for instance make a "test.xlsm" i have to change "normal.xlsm" into "test.xlsm" and then it works. How can i make a code without changing everytime the filename???
Thanks in advance...

1 reply

This discussion is closed to new replies.