ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Password Question (https://www.excelbanter.com/excel-programming/321732-re-password-question.html)

Kevin H. Stecyk[_2_]

Password Question
 
Patrick Simonds...
I have a workbook which I have created as a template, which is password
protected.

Each week I want to be able to open that template file from within another
workbook, but can not figure out how to have the VBA enter the password
and then select read only. After the file is open I have some VBA code
which will save it to a set directory with a title based on the date.



Workbooks.Open Filename:=ThisWorkbook.Path & "\MyBook.xls",
Password:="TopSecret1", ReadOnly:=True

This assumes that the files are stored in the same directory.

HTH

Regards,
Kevin



Patrick Simonds

Password Question
 
Actually, the workbook will be in another directory.



"Kevin H. Stecyk" wrote in message
...
Patrick Simonds...
I have a workbook which I have created as a template, which is password
protected.

Each week I want to be able to open that template file from within
another workbook, but can not figure out how to have the VBA enter the
password and then select read only. After the file is open I have some
VBA code which will save it to a set directory with a title based on the
date.



Workbooks.Open Filename:=ThisWorkbook.Path & "\MyBook.xls",
Password:="TopSecret1", ReadOnly:=True

This assumes that the files are stored in the same directory.

HTH

Regards,
Kevin




Kevin H. Stecyk[_2_]

Password Question
 
Patrick,

Can you substitute the new directory in place of
Filename:=ThisWorkbook.Path?

Kevin


Patrick wrote,
Actually, the workbook will be in another directory.



"Kevin H. Stecyk" wrote in message
...
Patrick Simonds...
I have a workbook which I have created as a template, which is password
protected.

Each week I want to be able to open that template file from within
another workbook, but can not figure out how to have the VBA enter the
password and then select read only. After the file is open I have some
VBA code which will save it to a set directory with a title based on the
date.



Workbooks.Open Filename:=ThisWorkbook.Path & "\MyBook.xls",
Password:="TopSecret1", ReadOnly:=True

This assumes that the files are stored in the same directory.

HTH

Regards,
Kevin






Patrick Simonds

Password Question
 
Yes

New code looks like this:

Workbooks.Open Filename:="C:\Documents and Settings\Patrick\Desktop\Backup
Board Assignments Template.xls", Password:="snapple", ReadOnly:=True


"Kevin H. Stecyk" wrote in message
...
Patrick,

Can you substitute the new directory in place of
Filename:=ThisWorkbook.Path?

Kevin


Patrick wrote,
Actually, the workbook will be in another directory.



"Kevin H. Stecyk" wrote in message
...
Patrick Simonds...
I have a workbook which I have created as a template, which is password
protected.

Each week I want to be able to open that template file from within
another workbook, but can not figure out how to have the VBA enter the
password and then select read only. After the file is open I have some
VBA code which will save it to a set directory with a title based on
the date.


Workbooks.Open Filename:=ThisWorkbook.Path & "\MyBook.xls",
Password:="TopSecret1", ReadOnly:=True

This assumes that the files are stored in the same directory.

HTH

Regards,
Kevin









All times are GMT +1. The time now is 11:59 AM.

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