Results 1 to 2 of 2

Variable Password While Saving Down Excel Sheets to Folder

Threaded View

  1. #1
    Registered User
    Join Date
    07-26-2019
    Location
    Scotland
    MS-Off Ver
    Office 365 Pro Plus
    Posts
    1

    Variable Password While Saving Down Excel Sheets to Folder

    Hi

    I am pretty new to VBA, which I'm using and learning through work. I have to be careful of what information I give away due to DPA... but I have a file which I have created code to break down into multiple tabs based on say a shop name like Tesco, Asda etc so that all sales for Tesco populate on 1 tab and then the formula then saves each tab individually into a folder. The issue I'm having is each of these tabs needs to be saved down password protected but I need the password to be different for each shop. So for Tesco it could be 123 for Asda 456 etc. What's the easiest way to go about this? I have an excel list with the shop name and the password on a separate file. Is the easiest way to use this?

    My code is as follows-

    Public Sub Save()
    Dim xWs As Worksheet
    Dim xDir As String
    Dim folder As FileDialog
    Set folder = Application.FileDialog(msoFileDialogFolderPicker)
    If folder.Show <> -1 Then Exit Sub
    xDir = folder.SelectedItems(1)
    For Each xWs In Application.ActiveWorkbook.Worksheets
    xWs.SaveAs xDir & "\" & xWs.Name, FileFormat = xlsx, Password = "Thisneedstobevaried"
    Next
    End Sub
    Last edited by AliGW; 07-26-2019 at 11:37 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Saving Excel Sheets into Specific Folder (inside same path)
    By ahmedhammam29 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2016, 09:35 PM
  2. [SOLVED] Saving excel sheets to folder - problem with Dim sFile ect
    By k1989l in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-01-2016, 08:11 AM
  3. Saving from excel into PDF Folder
    By scooby89 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2016, 05:56 PM
  4. Reduce processing time for saving excel sheets located in a folder
    By rexer231 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-06-2014, 05:28 AM
  5. Help with Saving Excel to SharePoint Folder
    By Inez15 in forum Excel General
    Replies: 6
    Last Post: 03-08-2013, 06:59 PM
  6. [SOLVED] Password array to open all password protected workbook in a folder
    By rename in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-07-2012, 05:06 AM
  7. HOW DO I PASSWORD AN EXCEL FOLDER
    By Hogi 14 in forum Excel General
    Replies: 1
    Last Post: 09-15-2005, 02:05 PM

Tags for this Thread

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