04-01-2016 04:06 PM
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)
Solved! Go to Solution.
04-04-2016 04:48 PM
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?
04-04-2016 05:17 PM
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
04-05-2016 12:50 PM - edited 04-05-2016 12:50 PM
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.