save as (without password and as xls file not macro enabled)

gleamng

Board Regular
Joined
Oct 8, 2016
Messages
98
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
  6. 2011
  7. 2010
  8. 2007
  9. 2003 or older
Platform
  1. Windows
  2. MacOS
  3. Mobile
  4. Web
Greeting to you all once again

i need help on this, i have a password macro enabled excel file but i want a macro that will save a copy of the file as value, xls (not macro file), using the file name and adding the current year to its name, please help me out on this also.

Thank you all.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Here is a very simple example.

Code:
Sub SaveWorkbookToDifferentFileFormat()
    Dim WB As Workbook
    Dim SaveFileName As String
    Dim Ans As Integer

    Set WB = ThisWorkbook

    'Create new name that includes the year
    SaveFileName = WB.Path & "\" & Split(WB.Name, ".")(0) & "_" & Year(Date) & ".xlsx"

    Ans = MsgBox(SaveFileName & vbCr & vbCr & "Continue?", vbYesNo, "Save to non-macro file")
    If Ans = vbYes Then
        WB.SaveAs Filename:=SaveFileName, FileFormat:=xlWorkbookDefault    '.xlsx
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

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