Reputation: 3746
I want copy target macro to new location:
Dim strDes As String
strDes = "D:\" & ActiveWorkbook.Name
FileCopy ActiveWorkbook.FullName, strDes
it occur error
permission denied
How can copy an Excel file that is open?
Upvotes: 1
Views: 2205
Reputation: 12612
You may copy the opened file using Scripting.FileSystemObject
Sub test()
src = ThisWorkbook.FullName
dest = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\"
CreateObject("Scripting.FileSystemObject").CopyFile src, dest
End Sub
Upvotes: 2