Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,616
- Office Version
- 365
- 2016
- Platform
- Windows
I copied a worksheet from an .xlsm workbook to a new workbook. The worksheet I copied has worksheet code associated to it. This code was copied over to the new workbook with the sheet.
How do I get rid of this code so I can save the new workbook as an .xlsx file. If I try to save the file as it is, a message pops up to advise the problem trying to save as an xlxx file and request confirmation to save outside an xlsm file.
I can press OK to save as an xlsx, but I'd prefer to have that done automatically.
How do I get rid of this code so I can save the new workbook as an .xlsx file. If I try to save the file as it is, a message pops up to advise the problem trying to save as an xlxx file and request confirmation to save outside an xlsm file.
I can press OK to save as an xlsx, but I'd prefer to have that done automatically.
Code:
Sub saveme()
Stop
Application.EnableEvents = False
Dim wb_diamonds As Workbook
Dim ws_diamonds As Worksheet
LastSheet = Sheets.Count
Worksheets("Front").Copy After:=Sheets(LastSheet)
ActiveSheet.Name = "COPY ME"
Worksheets("COPY ME").Unprotect
With Worksheets("COPY ME").Rows("1:6")
For Each shp In .Parent.Shapes
If Not Intersect(shp.TopLeftCell, .Cells) Is Nothing Then shp.Delete
Next shp
Stop
.Delete
End With
Worksheets("COPY ME").Columns("A:I").EntireColumn.Delete
Worksheets("COPY ME").Protect
Worksheets("COPY ME").Move
ActiveWindow.FreezePanes = False
fdate = Worksheets("COPY ME").Range("A5")
mnth = MonthName(Month(fdate), True)
day2 = Format(Day(fdate), "00")
dayt = UCase(Format(fdate, "ddd"))
sfile = day2 & " " & dayt
fPath = "D:\WSOP 2020\Distributables\" & mnth & "\" & sfile & "\"
fName = "Diamonds" & day2
sName = fPath & fName
fName = "Diamonds" & day2 & ".xlsx"
sName = fPath & fName
ActiveWorkbook.SaveAs sName
Set wb_diamonds = Workbooks(fName)
wb_diamonds.Worksheets("COPY ME").Name = "D" & day2
wb_diamonds.Save
wb_diamonds.Close
Application.EnableEvents = True
End Sub