2

I want to update all the links in a certain Excel file and I put the code on a VBScript. What is wrong with the following code?

file = Directory2 & Filename2
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(file)
objExcel.Application.Visible = True
objExcel.ActiveWorkbook.UpdateLink Name:=ActiveWorkbook.LinkSources 
objExcel.ActiveWorkbook.Save 
objExcel.ActiveWorkbook.Close

This returns:

Error code: 800A0400

1 Answer 1

4

VBScript doesn't support named parameters (Name:=ActiveWorkbook.LinkSources)

Name is the first argument to UpdateLink(), however, so just pass the value:

objWorkbook.UpdateLink objWorkbook.LinkSources

You were also using ActiveWorkbook without qualifying it. You need to use either:

objExcel.ActiveWorkbook.LinkSources

or

objWorkbook.LinkSources
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.