save as non macro enabled sheet and break link

stevemyers

Board Regular
Joined
Apr 25, 2014
Messages
62
I have the following code below. I need to correct the following issues:

1. I have a button that activates the code and I would like to button to disappear on the saved sheet.
2. There is no reason to save this as a macro enabled sheet.
3. When the saved sheet is re-saved it asks if the link should be updated..it should NOT and I don't want the user to be asked the question (eliminate the dialog box and choice)....maybe this will automatically happen when it is not saved as macro enabled?

Sub savesheet()
Const sPath As String = "\\AESBS\Company Shared Folders\!Quality System Records\NCMRs\2014\"
Sheet1.Copy
With ActiveWorkbook
.SaveAs Filename:=sPath & "NCM-" & Range("M2").Value & ".xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled
.Close
End With
Sheets("F_020").Select
ActiveWindow.SelectedSheets.PrintOut copies:=1, collate:=True, _
IgnorePrintAreas:=False
Sheets("F_020").Select

ActiveWorkbook.Close
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Is this what you had in mind.

Code:
  ' Remove the button
    ActiveSheet.Shapes("Button 3").Delete
    

  ' Disable excel alerts
    Application.DisplayAlerts = False
    

  ' Save as a ".xlsx"
    .SaveAs Filename:=sPath & "NCM-" & Range("M2").Value & ".xlsx", _
        FileFormat:=xlOpenXMLWorkbook
  

  ' Enable excel alerts
    Application.DisplayAlerts = True
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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