I have reports that go to customers and I want to save the file without macros for sending.
There is a 'main' file that runs analyses then saves a copy. The copy then has certain sheets changed to values and other sheets deleted.
I now want to save the new file as a nonmacro enable workbook.
Here is the code (Ithink the new code would go in at the bottom:
There is a 'main' file that runs analyses then saves a copy. The copy then has certain sheets changed to values and other sheets deleted.
I now want to save the new file as a nonmacro enable workbook.
Here is the code (Ithink the new code would go in at the bottom:
Rich (BB code):
Sub SaveCopyAs()
Dim ThisBook As Workbook, WkSht As Worksheet
Set ThisBook = ThisWorkbook
Dim strFullPath As String
Dim ReportName As String
Dim sXL_Path As String
strFullPath = Application.ActiveWorkbook.Path
sXL_Path = Left(strFullPath, InStrRev(strFullPath, "\"))
ReportName = Worksheets("Inputs").Range("B4")
Application.ScreenUpdating = False
ThisBook.SaveCopyAs Filename:=strFullPath & "\GeneratedReports\" & ReportName & ".xlsm"
Application.Workbooks.Open strFullPath & "\GeneratedReports\" & ReportName & ".xlsm"
' Paste Values
.............
Application.DisplayAlerts = False
' DELETE WorkSHEETS
For Each WkSht In ActiveWorkbook.Worksheets
Select Case WkSht.Name
'***************************************
'Sheets to be excluded (rename as required)
Case "Inputs", "EP_MeanStDev", "AEP", "OEP", "BatchProcessing"
'***************************************
Application.DisplayAlerts = False
WkSht.Delete
Case Else
'do nothing
End Select
Application.CutCopyMode = False
Next WkSht
I think I have to do it here
ActiveWorkbook.Save
ActiveWorkbook.Close
MsgBox "Copy Saved as: " & strFullPath & "\GeneratedReports\" & ReportName & ".xlsm"
End Sub