Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Yvon
 
Posts: n/a
Default Multiple workbook user's with Master workbook - all password protected

Hello,

Using Excel 2000.
This is the situation...I have 17 different workbooks representing 17
people's salary all linking to a summary workbook for my Manager to
view. Each workbook is password protected and when opening up the
summary workbook it prompts you for a password for each of those
individual workbooks as the summary links to the individual sheets. Of
course should you decline the password in the summary workbook it does
not link the data. Is there anyway around this???



Yvon Aubé
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

Maybe you could provide a workbook that opens those 17 workbooks first
(providing the passwords in code). Then open your real workbook.

I used 3 workbooks in my sample code. You can add as many workbook names and
passwords as you want--keep them in order, though:

Option Explicit
Sub auto_open()

Dim wkbks() As Workbook
Dim wkbkNames As Variant
Dim wkbkPwd As Variant
Dim iCtr As Long
Dim testStr As String

wkbkNames = Array("C:\book1.xls", _
"C:\book2.xls", _
"c:\my documents\excel\book3.xls")

wkbkPwd = Array("Pwd1", _
"Pwd2", _
"Pwd3")

If UBound(wkbkNames) = UBound(wkbkPwd) Then
'ok
Else
MsgBox "Design error--number of passwords < number of workbooks!"
Exit Sub
End If

ReDim wkbks(LBound(wkbkNames) To UBound(wkbkNames))

For iCtr = LBound(wkbkNames) To UBound(wkbkNames)
Set wkbks(iCtr) = Nothing
On Error Resume Next
Set wkbks(iCtr) = Workbooks.Open(Filename:=wkbkNames(iCtr), _
Password:=wkbkPwd(iCtr))
On Error GoTo 0

If wkbks(iCtr) Is Nothing Then
MsgBox wkbkNames(iCtr) & vbLf & "was not opened!"
End If
Next iCtr

Application.Calculate

'close the first 17 (total - 1 workbooks)
For iCtr = LBound(wkbks) To UBound(wkbks) - 1
If wkbks(iCtr) Is Nothing Then
'do nothing
Else
wkbks(iCtr).Close savechanges:=False
End If
Next iCtr

'ThisWorkbook.Close savechanges:=False
End Sub

When you're done testing (and after a save!), you can uncomment that .close
line. Then this workbook will open, then open the others, then close itself
(without saving!).

If all the workbooks were in the same folder, you could embed that folder name
in the .open line--instead of typing the path on each of the workbook names.

Kind of like:

Set wkbk = Workbooks.Open(Filename:="c:\my documents\" _
& wkbkNames(iCtr), _
Password:=wkbkPwd(iCtr))

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


==============
This area needs to be manipulated:

wkbkNames = Array("C:\book1.xls", _
"c:\my documents\excel\book2.xls")

Add 18 filenames to that list (17 linked + 1 real) and make sure that the last
workbook is the "real" workbook.



Yvon wrote:

Hello,

Using Excel 2000.
This is the situation...I have 17 different workbooks representing 17
people's salary all linking to a summary workbook for my Manager to
view. Each workbook is password protected and when opening up the
summary workbook it prompts you for a password for each of those
individual workbooks as the summary links to the individual sheets. Of
course should you decline the password in the summary workbook it does
not link the data. Is there anyway around this???

Yvon Aubé


--

Dave Peterson
  #3   Report Post  
Yvon
 
Posts: n/a
Default

Thanks Dave...worked like a charm! Y


Dave Peterson wrote in message ...
Maybe you could provide a workbook that opens those 17 workbooks first
(providing the passwords in code). Then open your real workbook.

I used 3 workbooks in my sample code. You can add as many workbook names and
passwords as you want--keep them in order, though:

Option Explicit
Sub auto_open()

Dim wkbks() As Workbook
Dim wkbkNames As Variant
Dim wkbkPwd As Variant
Dim iCtr As Long
Dim testStr As String

wkbkNames = Array("C:\book1.xls", _
"C:\book2.xls", _
"c:\my documents\excel\book3.xls")

wkbkPwd = Array("Pwd1", _
"Pwd2", _
"Pwd3")

If UBound(wkbkNames) = UBound(wkbkPwd) Then
'ok
Else
MsgBox "Design error--number of passwords < number of workbooks!"
Exit Sub
End If

ReDim wkbks(LBound(wkbkNames) To UBound(wkbkNames))

For iCtr = LBound(wkbkNames) To UBound(wkbkNames)
Set wkbks(iCtr) = Nothing
On Error Resume Next
Set wkbks(iCtr) = Workbooks.Open(Filename:=wkbkNames(iCtr), _
Password:=wkbkPwd(iCtr))
On Error GoTo 0

If wkbks(iCtr) Is Nothing Then
MsgBox wkbkNames(iCtr) & vbLf & "was not opened!"
End If
Next iCtr

Application.Calculate

'close the first 17 (total - 1 workbooks)
For iCtr = LBound(wkbks) To UBound(wkbks) - 1
If wkbks(iCtr) Is Nothing Then
'do nothing
Else
wkbks(iCtr).Close savechanges:=False
End If
Next iCtr

'ThisWorkbook.Close savechanges:=False
End Sub

When you're done testing (and after a save!), you can uncomment that .close
line. Then this workbook will open, then open the others, then close itself
(without saving!).

If all the workbooks were in the same folder, you could embed that folder name
in the .open line--instead of typing the path on each of the workbook names.

Kind of like:

Set wkbk = Workbooks.Open(Filename:="c:\my documents\" _
& wkbkNames(iCtr), _
Password:=wkbkPwd(iCtr))

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm


==============
This area needs to be manipulated:

wkbkNames = Array("C:\book1.xls", _
"c:\my documents\excel\book2.xls")

Add 18 filenames to that list (17 linked + 1 real) and make sure that the last
workbook is the "real" workbook.



Yvon wrote:

Hello,

Using Excel 2000.
This is the situation...I have 17 different workbooks representing 17
people's salary all linking to a summary workbook for my Manager to
view. Each workbook is password protected and when opening up the
summary workbook it prompts you for a password for each of those
individual workbooks as the summary links to the individual sheets. Of
course should you decline the password in the summary workbook it does
not link the data. Is there anyway around this???

Yvon Aubé

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
Print all charts in a workbook (multiple worksheets) aewsaws Charts and Charting in Excel 4 May 12th 23 03:45 AM
Master Workbook used as my template? tb New Users to Excel 4 March 10th 05 11:42 PM
Protecting Workbook Paul Cooling Excel Discussion (Misc queries) 2 March 7th 05 11:55 AM
There is no way to view multiple sheets from one workbook kstub Excel Discussion (Misc queries) 3 December 17th 04 08:55 PM
Stubborn toolbars in Excel 007 Excel Discussion (Misc queries) 9 December 11th 04 02:02 PM


All times are GMT +1. The time now is 12:28 PM.

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

About Us

"It's about Microsoft Excel"