Remove modules during Save As?

jmersing

Well-known Member
Joined
Apr 14, 2004
Messages
887
I'm using the following to save a copy of my original file in a different directory. The problem is that when I do the SaveAs it is copying the modules to the new file and attempting to run them.

So I get an error saying "Youcan't save a file with the same name of a file that is already open"

Is there a way to strip out or deactivate the modules so they are not copied or activated?

HSub SaveAsFri()
Dim FileName As String
' Starts the save Friday Plan routine

clean_rows
Application.DisplayAlerts = False
M\SaveAs\PA2_Fri.xls",
ChDir "\\mcfl1d324\Pending\Friday_Plan"
ActiveWorkbook.SaveAs FileName:="\\mcfl1d324\Pending\Friday_Plan\PA2_Fri.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Columns("L:L").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.BreakLink Name:= _
"\\mcfl1d324\Pending\Friday_Plan\PA2_Fri.xls", Type:=xlExcelLinks
ActiveWorkbook.Save
MsgBox "Your File has Been saved and is ready for uploading", vbInformation, "Save Complete"

Application.Quit


Close ' Close
End Sub
Code:
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Watch MrExcel Video

Forum statistics

Threads
1,118,222
Messages
5,570,969
Members
412,352
Latest member
Radek Z
Top