Linking to password protected workbook

pangster

Board Regular
Joined
Jun 15, 2005
Messages
160
Hi,

Please can somebody help me with this problem?

I have a workbook (a summary of performance) which pulls data back from several other workbooks via linked cells (all these workbooks are password protected) - all have the same password.

The problem I have is that everytime the summary workbook is opened or tries to pull back data from one of these other workbooks - I'm prompted for a password.. is there a way to remove this or automate this :-? .

Thanks!
 
We'll have to avoid the Sendkeys if the source is open:

Code:
Sub UpDateLinks()
    Const PWord As String = " "
    Dim xlLinks
    Dim i As Integer
    Dim wb As Workbook
    Dim wbOpen As Boolean
    xlLinks = ThisWorkbook.LinkSources(xlExcelLinks)
    If Not IsEmpty(xlLinks) Then
        For i = 1 To UBound(xlLinks)
            wbOpen = False
            For Each wb In Workbooks
                If wb.FullName = xlLinks(i) Then
                    wbOpen = True
                    Exit For
                End If
            Next wb
            If wbOpen = False Then
                SendKeys PWord & "{Enter}"
                ThisWorkbook.UpdateLink Name:=xlLinks(i)
            End If
        Next i
    End If
End Sub


This would work for what I am doing except I have to update my links. I know you say hit don't update but if I don't my data won't transfer over? This makes doing this a mute point... So, is there a way to update the links AND have the password pop-up disabled (like autogenerate what the password was into the pop-up or something)?
Please let me know any suggestions!

Thanks
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I have to be able to select "Update" to update my sheet without prompting for a password and I also have to be able to hit "Don't Update" to make it where I can go back and look at old data.
 
Upvote 0
We'll have to avoid the Sendkeys if the source is open:

Code:
Sub UpDateLinks()
    Const PWord As String = " "
    Dim xlLinks
    Dim i As Integer
    Dim wb As Workbook
    Dim wbOpen As Boolean
    xlLinks = ThisWorkbook.LinkSources(xlExcelLinks)
    If Not IsEmpty(xlLinks) Then
        For i = 1 To UBound(xlLinks)
            wbOpen = False
            For Each wb In Workbooks
                If wb.FullName = xlLinks(i) Then
                    wbOpen = True
                    Exit For
                End If
            Next wb
            If wbOpen = False Then
                SendKeys PWord & "{Enter}"
                ThisWorkbook.UpdateLink Name:=xlLinks(i)
            End If
        Next i
    End If
End Sub
Sorry for a newbie question. Is it possible to have example on how to write the links and such?
How would this code look like if:
Password = 123Goodday
Workbook name = excel_beginner_school.xslm
Link = C:\Documents\My projects\New
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top