Sorry if this is a simple question, but I am trying to add a password to the spreadsheet I am saving via a macro.
What would I need to add to the below and whereabouts should I inset
Worksheets("YEAR_PERIOD").Select
Range("A2").Select
FMSYEAR = ActiveCell.Value
Range("B2").Select
FMSPERIOD = ActiveCell.Value
FileName = ""drive":\"network path"\"file name_Y" & Trim(YEAR) & "_P" & Trim(PERIOD) & ".xlsx"
ActiveWorkbook.SaveAs FileName:= _
FileName _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Sheets("BUTTON").Select
ActiveWindow.SelectedSheets.Delete
Sheets("YEAR_PERIOD").Select
ActiveWindow.SelectedSheets.Delete
ActiveWorkbook.Save
Application.ScreenUpdating = True
Application.ScreenUpdating = True
MsgBox "Report has now been saved."
Bookmarks