I used to run this with the line
This no longer works following an upgrade to PI and the PI Excel version we use.
Clearly I'm no expert, can anyone help me out?
My apologize, I did not read that you upgraded to PI Datalink 2014.
Since you have upgraded to PI Datalink 2014 (5.1.0) you could use the method explained in KB01035 - Recalculate a PI DataLink function without using the right-click menu which does not need PIDLdialogs and also avoids using the right-click menu.
The current error that you are getting is due to the following known issue: 18968OSI8 - Functions not entered as formula array don't Recalculate(Resize). Functions not entered as formula array do not Recalculate(Resize). This was used in previous versions to PI Datalink 2014.
Would you be ok with the option suggested in the KB01035 in order to update the calculations?
The code sample looks like it is trying to show an Excel form called "showSampDat".
The form may have a reference to a PI related object.
If you can get to the VBA code for the spreadsheet, go to the menu item "Tools", and select "References".
It sounds like you may have a missing reference (perhaps the file name changed or location?)
Perhaps include a scree shot?
The code (which did work in my previous life before we upgraded software):
ActiveCell.Value = "=PISampDat($P$41,$J$44,$J$46,$J$48,1,$P$42)"
Looks like we've upgraded to PI Datalink 2014, and I'm guessing there's a setting changed or the function has changed its name.
Please try changing Application.Run "showSampDat" with Call DLResize
An example of it is the following:
Previous working code before the update:
Sheets("Cooling Tower Level").Select
Working code after the update:
Thanks for your advice.
I tried using "Call DLResize" and now get a different error:
Sub or Function not defined
For this code to work properly, you will need to insert a VBA Reference to ' PIDLDialogs.xla '
Could you please try the steps described and let me know the result?
Then in Microsoft Visual Basic For Applications
Let me know if this does the trick.
I think this has almost cracked it.
When I run this now, the new error message says
"DLresize : 1004 : No cells were found"
If I manually then right-click and Resize the function from the right-click menu the data appears.
You have fixed it, great article too, thanks for the steer!
I am glad it helped, now you have ways of solving the issue for different versions .
The best approach for PI DataLink 2014+ to resize/recalculate PI DataLink functions would be to use two native PI DataLink functions which are new as of 2014: SelectRange and ResizeRange. The following article has a nice example of this:
KB01035 - Recalculate a PI DataLink function without using the right-click menu
The example file with code can be downloaded here:
Edit: just noticed that Carlos already pointed you to this article.
Retrieving data ...