ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting an Open-file password (https://www.excelbanter.com/excel-programming/326810-setting-open-file-password.html)

terry

Setting an Open-file password
 
Hi All,

Can anyone assist me in the code I need to write to password protect a file
so that the user is prompted for a password when attempting to open the file.

Kind Regards,

Terry

JulieD

Setting an Open-file password
 
Hi Terry

no code needed, save the file using file save as ... choose tools in the
dialog box toolbar, general options - and you can then set a password to
open and /or a password to modify.


--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"Terry" wrote in message
...
Hi All,

Can anyone assist me in the code I need to write to password protect a
file
so that the user is prompted for a password when attempting to open the
file.

Kind Regards,

Terry




terry

Setting an Open-file password
 
Hi Julie,

The excel file is created in an automated process from DTS within MSSQL 2000.

Thanks,
Terry

"JulieD" wrote:

Hi Terry

no code needed, save the file using file save as ... choose tools in the
dialog box toolbar, general options - and you can then set a password to
open and /or a password to modify.


--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"Terry" wrote in message
...
Hi All,

Can anyone assist me in the code I need to write to password protect a
file
so that the user is prompted for a password when attempting to open the
file.

Kind Regards,

Terry





keepITcool

Setting an Open-file password
 

Terry,

following opens a file,
if it doesnt have a password then saves it WITH the password
then closes it.

error handling (file should exist etc, pw cannot be zero lenght..
to be added.

Sub OpenAndSaveWithPW(strFullPath$, strPW$)
With Workbooks.Open(strFullPath, Password:=strPW)
If Not .HasPassword Then
Application.DisplayAlerts = False
.SaveAs .FullName, Password:=strPW
Application.DisplayAlerts = True
End If
.Close
End With
End Sub





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Terry wrote :

Hi Julie,

The excel file is created in an automated process from DTS within
MSSQL 2000.

Thanks,
Terry

"JulieD" wrote:

Hi Terry

no code needed, save the file using file save as ... choose tools
in the dialog box toolbar, general options - and you can then set a
password to open and /or a password to modify.


--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"Terry" wrote in message
...
Hi All,

Can anyone assist me in the code I need to write to password
protect a file
so that the user is prompted for a password when attempting to
open the file.

Kind Regards,

Terry






All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com