Can a Hyperlink copy a file?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible in a hyperlink, to make it first copy a file to a new location
and then open the new copy?
 
Not via a hyperlink. But maybe you could use a macro that accomplishes this.

Look at filecopy in VBA's help and workbooks.open.

For example, I could put a shape on the the worksheet, rightclick and assign it
this macro:

Option Explicit
Sub testme()

Dim myFromFolder As String
Dim myToFolder As String
Dim myFileName As String

myFromFolder = "C:\my documents\excel\"
myToFolder = "C:\my documents\excel\test\"
myFileName = "book1.xls"

FileCopy Source:=myFromFolder & myFileName, _
Destination:=myToFolder & myFileName

Workbooks.Open myToFolder & myFileName

End Sub
 
Back
Top