+ Reply to Thread
Results 1 to 6 of 6

Save as Excel file with password VBA

  1. #1
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Save as Excel file with password VBA

    I have a code which i use to save my excel file to a specified folder.

    I want to modify this code so that i can add " password" to the file.

    Basically it will save the file and the user needs to enter the password to open the file .

    the code which i use to save as is :

    Please Login or Register  to view this content.
    Last edited by anilpatni1234; 12-10-2017 at 06:44 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,317

    Re: Save as Excel file with password VBA

    See the Help for ActiveWorkbook.SaveAs (in the VBA, select the SaveAs command and press F1 to get the Help)

    Syntax

    expression.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)

    expression A variable that represents a Workbook object.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Save as Excel file with password VBA

    Hey,

    Could you please guide me on where to put the code in the code which i have?
    I am new to VBA. Please help me

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,317

    Re: Save as Excel file with password VBA

    You already have most of the code ...

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-18-2017
    Location
    india
    MS-Off Ver
    2010
    Posts
    490

    Re: Save as Excel file with password VBA

    hey thank you so much. this worked wonders for me.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,317

    Re: Save as Excel file with password VBA

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Remove password on save file as .xlsm
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2014, 07:21 PM
  2. Set password to save excel file.
    By sureshpunna in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-08-2014, 12:13 AM
  3. Replies: 1
    Last Post: 01-16-2013, 02:02 AM
  4. [SOLVED] Excel 2007 VBA to save a file password protected
    By jo15765 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2012, 10:31 PM
  5. VBA to save a file with a password
    By Ang12345 in forum Excel General
    Replies: 1
    Last Post: 10-08-2010, 05:11 PM
  6. Save generated xml file to a web folder with user name and password
    By skumaar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2010, 12:02 PM
  7. Save file without a password req
    By Ctech in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-02-2005, 06:20 PM

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