Results 1 to 6 of 6

Save as Excel file with password VBA

Threaded View

  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 :

    Private Sub CommandButton1_Click()
    Dim path As String
    Dim filename1 As String
    Dim filename2 As String
        
    path = "C:\Users\Dell\Desktop\Invoices\"
    filename1 = Range("C3").Text
    filename2 = Range("Q41").Text
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:=path & filename1 & "-" & filename2 & ".xlsx", FileFormat:=xlOpenXMLWorkbook
    Application.DisplayAlerts = True
    
    End Sub
    Last edited by anilpatni1234; 12-10-2017 at 06:44 AM.

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