Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
macro to input password when saving doc in excel
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?. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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?. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
macro to input password when saving doc in excel
Note: as written, if A1 is empty, the pword will be blank so will not be
required upon opening. Make this change pword = Sheets("Sheet1").Range("A1").Value If pword = "" Then Exit Sub 'add this line here Application.DisplayAlerts = False Gord On Wed, 29 Oct 2008 13:10:12 -0700, Gord Dibben <gorddibbATshawDOTca wrote: 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?. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
run macro with input msg based on cell input | Excel Discussion (Misc queries) | |||
Trouble with saving user input in an Excel Form. | Excel Discussion (Misc queries) | |||
How to see macro code of a password protected macro without a password? | Excel Worksheet Functions | |||
Have cell require input before saving. | Excel Discussion (Misc queries) | |||
Password box to remain open after wrong input | Excel Discussion (Misc queries) |