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:
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,214,670
Messages
6,120,830
Members
448,990
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top