Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Opening Linked Workbooks from Summary


Hi Everyone!
I have a summary workbook which links to 6 other workbooks which all
have different passwords to open them. I want to be able to open the
summary workbook and update the links without having to type in all the
passwords for each linked workbook. I was told the best way is to run a
VBA script to open each linked workbook with its associated password.
Can someone please help me out with the code. I am still learning VBA
and any help is greatly greatly appreciated. Where do I start?

Thanks,
Julie


--
zapszipszops
------------------------------------------------------------------------
zapszipszops's Profile: http://www.excelforum.com/member.php...o&userid=33217
View this thread: http://www.excelforum.com/showthread...hreadid=531409

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Opening Linked Workbooks from Summary

Saved from a previous post:

Untested.

Maybe you could have a helper workbook open your workbook and not update the
links.

Then it could open each of the 14 other workbooks (the links should refresh when
the workbook opens), then close that workbook and open the next.

Kind of like this:

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

zapszipszops wrote:

Hi Everyone!
I have a summary workbook which links to 6 other workbooks which all
have different passwords to open them. I want to be able to open the
summary workbook and update the links without having to type in all the
passwords for each linked workbook. I was told the best way is to run a
VBA script to open each linked workbook with its associated password.
Can someone please help me out with the code. I am still learning VBA
and any help is greatly greatly appreciated. Where do I start?

Thanks,
Julie

--
zapszipszops
------------------------------------------------------------------------
zapszipszops's Profile: http://www.excelforum.com/member.php...o&userid=33217
View this thread: http://www.excelforum.com/showthread...hreadid=531409


--

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
auto updating & linking 2 workbooks without opening the linked brenner Excel Discussion (Misc queries) 8 January 31st 09 12:15 AM
Summary from unopened workbooks BNT1 via OfficeKB.com Excel Discussion (Misc queries) 9 October 1st 08 08:23 PM
summary of data from several workbooks in another des-sa[_2_] Excel Discussion (Misc queries) 16 May 13th 08 11:19 PM
Summary Worksheet from Multiple Workbooks eddie_zoom Excel Worksheet Functions 1 February 22nd 06 03:42 PM
Multiple Workbooks Summary tcgaines Excel Worksheet Functions 0 December 13th 05 05:31 PM


All times are GMT +1. The time now is 09:48 PM.

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"