Hi
Very new to VBA, have been using a bit of code which saves a copy of a workbook to a different location and also clears cell contents in the original workbook this works great, what I have been trying to do is to add a bit more code to have the VBA deleted in the copy NOT the original workbook if that makes sense?? Did try saving the copy as a xlsx format as I thought that would strip the code but then when I try and open the copy I get an error and cant open it....something about file extention not matching...sorry for my noobness
not sure how to proceed please see code below.
Many thanks for any advice
Private Sub CommandButton3_Click()
Dim nom As String
Dim newFile As String, fName As String
Dim wb As Workbook
Set wb = ActiveWorkbook
fName = Range("D4").Value
newFile = fName & " " & Format$(Date, "mmmm-dd-yyyy")
ActiveWorkbook.SaveCopyAs Filename:="G:\Production - Shared\Saved Machine Logs\" & newFile & ".xlsm"
Sheet1.Range("A8:D100,D4,F8:G100,J8:N100,Q8:S100,W8:X100").ClearContents
ActiveWorkbook.Save
Application.Quit
End Sub
Bookmarks