ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to force Excel to Open And Update Links

Solved!
Go to solution

I have an Excel Macro file .xlsm that I am sending data to and receiving results from after the data is calculated. Some of those calculations are through an .xla Link. NORMALLY when a human opens the file, the linkis opened and updated and everyone can go about their business.

 

I ended up explicitely opening the link with another workbook open statement, but that cannot be right right way. What if the .xla changes names, or is moved? There must be a better way. The excel macro record even managed to just give me the explicit pathname and not a programmically way to open it like Workbook.OpenMyStupidLinksYouFool. Ugh.

 

For reference I tried adding parameters to the open command, and Diadem compile errored and said I cannot use parentheses. There are already parenteses. huh?

Excel Open Method:

https://msdn.microsoft.com/en-us/library/office/bb179167(v=office.12).aspx

 

Safe:

Excel.Workbooks.Open(sPathDocuments & "" & DiademExcelWorkbook)

 

Error:

Excel.Workbooks.Open(sPathDocuments & "" & DiademExcelWorkbook,3)

 

 

0 Kudos
Message 1 of 4
(6,222 Views)

Based on the way I read your post, it seems like the issue may be with the Excel macro. Specifcally, what functionality are you trying to incorporate into your DIAdem script using the OLE interface?

0 Kudos
Message 2 of 4
(6,180 Views)
Solution
Accepted by topic author sg000

Hi sg,

 

The specific error you got has nothing to do with DIAdem or Excel. If you want to call a function in a VBScript that has more than one parameter, and if you use parentheses in the calling syntax, then the "Call " prefix is required.

 

Call Excel.Workbooks.Open(sPathDocuments & DiademExcelWorkbook, 3)

I'm also not sure what you were up to with the & "" & construction, so I simplified it above.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 4
(6,175 Views)

I cannot test your solution right now Brad, but its definiitely something to be aware of that I wasn't.

 

QT - Its not the macro, but the Excel document contains links and I need those links to open when I open the Exxcel document.

 

I fixed it temporarily by forcing open the link from Diadem but normally you might not know what that link is.

0 Kudos
Message 4 of 4
(6,155 Views)