ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open en close a workbook with password (https://www.excelbanter.com/excel-programming/295301-open-en-close-workbook-password.html)

Morrigu

Open en close a workbook with password
 
Hi,

I have a workbook with VBA code, that opens another workbook, collect
info from some cells and then closes the second workbook.

That works fine, but now i have a password for opening on the secon
workbook.

i can send this with my opening code, and then i don't get the passwor
input box. That's ok.
for example:
Workbooks.Open Filename:= "D:\test.xls", Password:="test"

But when the workbook is closed i always get the input box.

i can't find how i can send the password with the closing statement.

activeworkbook.close doesn't have a password property.
activeworkbook.saveas does, but then i get the question for overwrit
the workbook.

I don't want that eather.

I hope this is clear and someone has an answer or maybe a more easy wa
to do this.

greetz,
To

--
Message posted from http://www.ExcelForum.com


Pete McCOsh

Open en close a workbook with password
 
Tom,

could it be something recalculating in the second workbook
when you open it and the prompt being to save changes?

If so, this might help:

Activeworkbook.close savechanges:=false

If not, is there any way of getting the data out without
opening the workbook?

Pete
-----Original Message-----
Hi,

I have a workbook with VBA code, that opens another

workbook, collects
info from some cells and then closes the second workbook.

That works fine, but now i have a password for opening on

the second
workbook.

i can send this with my opening code, and then i don't

get the password
input box. That's ok.
for example:
Workbooks.Open Filename:= "D:\test.xls", Password:="test"

But when the workbook is closed i always get the input

box.

i can't find how i can send the password with the closing

statement.

activeworkbook.close doesn't have a password property.
activeworkbook.saveas does, but then i get the question

for overwrite
the workbook.

I don't want that eather.

I hope this is clear and someone has an answer or maybe a

more easy way
to do this.

greetz,
Tom




All times are GMT +1. The time now is 03:17 PM.

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