Referencing password protected Workbook

V

Viggy

I have workbook A and Workbook B, both of which have a password on th
workbook and on read-only password...

While running A, I need to call a sub within B, without B being open..
THe problem has been that no matter what I try, B opens up, and ask
for the password... Is there anyway to reference the method in
without B opening up, given that B is password protected?

Thanks,
Vigg
 
R

Rob Bovey

Viggy > said:
I have workbook A and Workbook B, both of which have a password on the
workbook and on read-only password...

While running A, I need to call a sub within B, without B being open...

Hi Viggy,

Unfortunately, there is no way to do this. You must open a workbook in
order to call any code that it contains.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 
F

Frank Kabel

Hi
for referencing a method you HAVE to open the other workbook. One way
would be to use
workbooks.open
together with the password of this file
 
V

Viggy

Whats the syntax for opening the file with the password?

(i'm assuming something along the lines of :
Open.file password:= "stuff")

Also, is there a way to open the file, such that the user can't se
that its open
 
R

Rob Bovey

Whats the syntax for opening the file with the password?

Workbooks("MyBook.xls").Open password:="MyPassword"
Also, is there a way to open the file, such that the user can't see
that its open?

The easiest way is to save it as a hidden workbook. Choose Window/Hide
from the Excel menu and save it that way from the Visual Basic Editor.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


news:[email protected]...
 
F

Frank Kabel

Hi
just look at the Excel VBA help :)

e.g.
Sub foo()
Application.ScreenUpdating = False
Workbooks.Open Filename:="D:\temp\test.xls",
WriteResPassword:="your_password"
Application.ScreenUpdating = True
End Sub
 
Top