Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Saving with password

I have files that I need to save with a passord each month. I'd like to
automate this as the password will be the same. The location (of all the
files) will be different each month, so using SaveAs won't help too much
unless I want to change the code each month. I tried ThisWorkbook Save and
ActiveWorkbook Save and they didn't work with Pasword. Anyione have any
thouhts?

Thanks,

Alan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Saving with password

Hi Alan,

Perhaps, try something like:

'=============
Public Sub Tester()
Const PWORD As String = "ABC" '<<==== CHANGE

Application.DisplayAlerts = False
With ActiveWorkbook
.SaveAs Filename:=.FullName, _
Password:=PWORD
End With
Application.DisplayAlerts = True
End Sub
'<<=============



---
Regards,
Norman


"Alan P" wrote in message
...
I have files that I need to save with a passord each month. I'd like to
automate this as the password will be the same. The location (of all the
files) will be different each month, so using SaveAs won't help too much
unless I want to change the code each month. I tried ThisWorkbook Save and
ActiveWorkbook Save and they didn't work with Pasword. Anyione have any
thouhts?

Thanks,

Alan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Saving with password

How would Using SAVE rather than SAVEAS correct the problem?


There is no way for the code to know or discover the correct location?

If the workbook has already been saved and you just want to apply a password
to it, then use

Application.DisplayAlerts = False
Thisworkbook.SaveAs Thisworkbook.FullName, Password:="CouldItBeSoSimple"
Application.DisplayAlerts = True


or replace thisworkbook with activeworkbook if the book containing the code
is not the book being saved.
--
Regards,
Tom Ogilvy


"Alan P" wrote:

I have files that I need to save with a passord each month. I'd like to
automate this as the password will be the same. The location (of all the
files) will be different each month, so using SaveAs won't help too much
unless I want to change the code each month. I tried ThisWorkbook Save and
ActiveWorkbook Save and they didn't work with Pasword. Anyione have any
thouhts?

Thanks,

Alan

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
macro to input password when saving doc in excel Nissassa Excel Discussion (Misc queries) 2 October 29th 08 08:22 PM
PASSWORD REMOVAL I have the password to open the file and the password to modify the file now how to remove them LJ[_4_] Excel Programming 0 April 27th 06 03:18 AM
HELP! Get error while saving after password protection monica Excel Programming 2 December 15th 05 09:30 PM
Password window popping up when saving Atchoum Excel Programming 0 September 22nd 04 09:20 PM


All times are GMT +1. The time now is 02:54 PM.

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

About Us

"It's about Microsoft Excel"