Update Links

Hi,

Im trying to update my links on workbook opening

so in the thisworkbook object, on open, i have the below sub, i am getting the error message

"Application defined or object defined" error

What is the error?

Thanks

Private Sub Workbook_Open()
Dim AWB As String

AWB = ActiveWorkbook.FullName

ActiveWorkbook.UpdateLink Name:=AWB, Type:=xlExcelLinks
End Sub

Open in new window

Seamus2626Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rob HensonFinance AnalystCommented:
Why have a sub to do that?

In Excel Options > Advanced - towards the bottom of the pane there is an option for "Ask to Update Automatic links". If you uncheck that option, you won't be asked about updating and it will just do it.

Thanks
Rob H
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rgonzo1971Commented:
Hi,

pls try

ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources

Regards
0
Seamus2626Author Commented:
Ron, passes this spreasdheet onto other users, so cant guarantee that they will have links auto updating

Rgonzo, i stuck that in the editor and was still asked to update links on entry....
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Rob HensonFinance AnalystCommented:
Doing it by macro - can't guarantee that other users will enable macros.

Either way, you still have to rely on user clicking the Enable Content button.

Thanks
Rob
0
Seamus2626Author Commented:
All users do have macros enabled....
0
Seamus2626Author Commented:
Ive went to town with protection, ive turned my options on as above to enable updates and im still getting a warning message!

Private Sub Workbook_Open()

ActiveSheet.Unprotect ("football")


Application.AskToUpdateLinks = False
Application.DisplayAlerts = False



    Dim blnSUpdating    As Boolean
    
    With Application
        blnSUpdating = .ScreenUpdating
        .ScreenUpdating = False
    End With
ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources

Application.ScreenUpdating = blnSUpdating

Application.DisplayAlerts = True
Application.AskToUpdateLinks = True


ActiveSheet.Protect ("football")


End Sub

Open in new window

0
Rob HensonFinance AnalystCommented:
Where are you putting the Workbook_Open sub?

It has to be on the ThisWorkbook module.

Thanks
Rob
0
Rob HensonFinance AnalystCommented:
I guess we are looking at the order that things are processed when a workbook opens.

1)Update Links
2)Workbook_Open Sub

or

1)Workbook_Open Sub
2)Update Links

As the Update Links is a General Option, ie at application level and not Workbook specific, I suspect it does this check first then once the Workbook is open it will run the Workbook_Open routine.

Thanks
Rob H
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.