View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default macro to input password when saving doc in excel

Sub Saveit_Pword()
Dim pword As String
pword = ActiveWorkbook.Sheets("Sheet1").Range("A1").Value
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
ActiveWorkbook.Name, FileFormat:=xlNormal _
, Password:=pword, WriteResPassword:=pword, ReadOnlyRecommended:= _
False, CreateBackup:=True
Application.DisplayAlerts = True
End Sub

Will save to the default folder with a password you enter in Sheet1 A1


Gord Dibben MS Excel MVP

On Wed, 29 Oct 2008 08:28:00 -0700, Nissassa
wrote:

Hi, every day I create a large number of sensitive excel spreadsheets that
need to be saved with a password that changes every day.

I have tried recording a macro (I am not a programmer) to do it and I have
succeeded to some degree in that it copies the data from a specific cell and
inserts it into the password section when saving the document, the only
problem is that it takes the data that was originally in the cell ie the data
that was in the cell when the macro was created, not the new data that I
would input each day into the relevant cell

Does anyone out there know how I can do this?.