Link update to external files with password

fontmar

New Member
Joined
Nov 3, 2016
Messages
12
Hi,
I have one worksheet with links to 4 different external files (.xlsm) protected by a password, located on a server.

So I have 4 macros opening each file (run by a macro) and the links can update. But I don't understand why only the last range is update and all the others have the #REF error.

Can I have some help on that?

Thanks

Sub file1()
'On Error GoTo here
Application.ScreenUpdating = False
Set ctc = Workbooks.Open(Filename:="file:///\\Server\Public\Documents\Folder\2017\File1\File1Name.xlsm", ReadOnly:=True, Password:="password")
ctc.Close False
here:
Application.ScreenUpdating = True
End Sub

Sub file2()
'On Error GoTo here
Application.ScreenUpdating = False
Set ctc = Workbooks.Open(Filename:="file:///\\Server\Public\Documents\Folder\2017\File2\File2Name.xlsm", ReadOnly:=True, Password:="password")
ctc.Close False
here:
Application.ScreenUpdating = True
End Sub

Sub file3()
'On Error GoTo here
Application.ScreenUpdating = False
Set ctc = Workbooks.Open(Filename:="file:///\\Server\Public\Documents\Folder\2017\File3\File3Name.xlsm", ReadOnly:=True, Password:="password")
ctc.Close False
here:
Application.ScreenUpdating = True
End Sub

Sub file4()
'On Error GoTo here
Application.ScreenUpdating = False
Set ctc = Workbooks.Open(Filename:="file:///\\Server\Public\Documents\Folder\2017\File4\File4Name.xlsm", ReadOnly:=True, Password:="password")
ctc.Close False
here:
Application.ScreenUpdating = True
End Sub

Sub update_all()
file1
file2
file2
file4
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,214,553
Messages
6,120,182
Members
448,948
Latest member
spamiki

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