Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.misc
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?.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
run macro with input msg based on cell input Janelle S Excel Discussion (Misc queries) 0 January 20th 08 05:23 AM
Trouble with saving user input in an Excel Form. University of Maine student Excel Discussion (Misc queries) 0 March 14th 06 07:31 PM
How to see macro code of a password protected macro without a password? Dmitry Kopnichev Excel Worksheet Functions 5 October 27th 05 09:57 AM
Have cell require input before saving. couriced Excel Discussion (Misc queries) 1 October 20th 05 04:36 PM
Password box to remain open after wrong input Twanny Excel Discussion (Misc queries) 4 September 1st 05 09:29 PM


All times are GMT +1. The time now is 09:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"