File save code help

jcaptchaos2

Well-known Member
Joined
Sep 24, 2002
Messages
1,032
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have this code that names and saves the file, it works fine but I would like to have it save the file without having the macro's still available. The range of the data I would like to save is from A1 -J49

Code:
Sub man_save_to_folder()
    Dim SaveRange As Range
        Set SaveRange = Sheets("Weight Control Sheet").Range("p5")
       Application.DisplayAlerts = False
        ActiveSheet.Unprotect Password:=""
    With Sheets("Weight Control Sheet")
        ActiveSheet.Copy
        

        Range("p5").Value = Range("p5").Value
    End With
    
    If SaveRange = "" Then SaveRange = _
        InputBox("The workbook name is blank please type a save name", "Workbook Name")

ActiveWorkbook.SaveAs _
        FileName:="N:\Engineering\Weight Control Sheets\" & SaveRange.Value & ".xls" _
        , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
        ReadOnlyRecommended:=False, CreateBackup:=False
        ActiveSheet.Protect Password:=""
    ActiveWorkbook.Close
    Application.DisplayAlerts = True
    ActiveSheet.Protect Password:=""
End Sub
 

Excel Facts

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

Here is a code snippet to get you started.

Code:
    fldPath = ThisWorkbook.Path
    ActiveSheet.Copy
    ActiveWorkbook.SaveAs fldPath & "\WB1.xlsx", FileFormat:=xlOpenXMLWorkbook
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

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