Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Links to password protected workbooks


I have a workbook that has links from many other workbooks. They all
feed from workbooks that are password protected to open. I need a
macro or some way of not having to put all the passwords in everytime I
open and update my main workbook. All of the passwords are the same.
Any suggestions? Thanks.


--
Nesta777
------------------------------------------------------------------------
Nesta777's Profile: http://www.excelforum.com/member.php...o&userid=36412
View this thread: http://www.excelforum.com/showthread...hreadid=562716

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Links to password protected workbooks

How about just having another workbook that opens your workbook with the links
updated/not updated the way you want. Then the code continues to open the other
workbooks.

Saved from a previous post:

Option Explicit
Sub testme()

Dim myFileNames As Variant
Dim myPasswords As Variant
Dim iCtr As Long
Dim myRealWkbk As Workbook
Dim myRealWkbkName As String
Dim wkbk As Workbook

myRealWkbkName = "C:\my documents\excel\book1.xls"

myFileNames = Array("C:\my documents\excel\book11.xls", _
"C:\my documents\excel\book21.xls", _
"C:\my other folder\book11.xls")

myPasswords = Array("pwd1", _
"pwd2", _
"pwd3")

If UBound(myFileNames) < UBound(myPasswords) Then
MsgBox "check names & passwords--qty mismatch!"
Exit Sub
End If

Set myRealWkbk = Workbooks.Open(Filename:=myRealWkbkName, UpdateLinks:=0)

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

If wkbk Is Nothing Then
MsgBox "Check file: " & myFileNames(iCtr)
Exit Sub
End If

wkbk.Close savechanges:=False
Next iCtr

End Sub

(I got bored after 3 workbooks. You may want to test it with a couple to get it
going.)

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

Nesta777 wrote:

I have a workbook that has links from many other workbooks. They all
feed from workbooks that are password protected to open. I need a
macro or some way of not having to put all the passwords in everytime I
open and update my main workbook. All of the passwords are the same.
Any suggestions? Thanks.

--
Nesta777
------------------------------------------------------------------------
Nesta777's Profile: http://www.excelforum.com/member.php...o&userid=36412
View this thread: http://www.excelforum.com/showthread...hreadid=562716


--

Dave Peterson
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
Password protected workbooks Mike Stanley Excel Discussion (Misc queries) 1 December 15th 05 11:16 PM
Protect Workbook vs Worksheet?? Dan B Excel Worksheet Functions 3 November 7th 05 09:02 PM
Links auto update on some workbooks but not others Tasza Excel Worksheet Functions 1 October 25th 05 01:04 AM
Multiple workbook user's with Master workbook - all password protected Yvon Excel Discussion (Misc queries) 2 March 30th 05 01:34 PM
Linking to a Password Protected Document in Excel 2000 Andrew Excel Discussion (Misc queries) 2 February 15th 05 01:06 AM


All times are GMT +1. The time now is 02:46 AM.

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

About Us

"It's about Microsoft Excel"