Save As is linking macro to saved workbook

jmersing

Well-known Member
Joined
Apr 14, 2004
Messages
887
I'm trying to create a copy of my file to a different directory. I'm using a cmd button on a form to call it. It works fine the first time but the next time it opens both files at once and then gives the message that "you can not save a file with the same name of a file that is open"

Why would my original macro migrate to the saved file?


Sub SaveAsFri()
' Starts the save Monday Plan routine

clean_rows
Application.DisplayAlerts = False

ChDir "E:\Friday_Plan"
ActiveWorkbook.SaveAs FileName:="E:\Friday_Plan\PA2_Fri.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1").Select
Application.CutCopyMode = False

MsgBox "Your File has Been saved and is ready for uploading", vbInformation, "Save Complete"
ThisWorkbook.Saved = False

Application.Quit


Close ' Closec
End Sub
Code:
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Watch MrExcel Video

Forum statistics

Threads
1,119,128
Messages
5,576,251
Members
412,709
Latest member
Rishu
Top