Results 1 to 4 of 4

How to add a password when saving a sheet

Threaded View

Adam125 How to add a password when... 07-01-2020, 03:03 AM
AliGW Re: How to add a password... 07-01-2020, 03:08 AM
davsth Re: How to add a password... 07-01-2020, 03:51 AM
Adam125 Re: How to add a password... 07-01-2020, 04:48 AM
  1. #1
    Registered User
    Join Date
    07-01-2020
    Location
    UK
    MS-Off Ver
    10
    Posts
    2

    How to add a password when saving a sheet

    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."
    Last edited by Adam125; 07-01-2020 at 04:01 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA: saving workbook with password error
    By Broobi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-08-2015, 10:25 AM
  2. [SOLVED] Password to Prevent Saving
    By prjt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2014, 02:43 PM
  3. vba code: password-required printing and saving
    By hydz1213 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2013, 09:40 AM
  4. [SOLVED] COmmand button requiring password, if password ok, unhide sheet.
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-04-2012, 09:43 AM
  5. VBA Project Password Stripped when saving as .xlsx
    By DRoberts in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-11-2009, 11:42 AM
  6. [SOLVED] HELP! Get error while saving after password protection
    By monica in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-15-2005, 06:35 PM
  7. [SOLVED] Saving ftp login password ?
    By Gershon Shamay in forum Excel General
    Replies: 0
    Last Post: 04-18-2005, 03:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1