Professional OPC
Development Tools

logos

VBA Examples in Excel

More
18 Jan 2018 16:31 #5882 by support
Replied by support on topic VBA Examples in Excel
Hello.

I was able to reproduce the issue, but *only* on a computer that had multiple version of the product (or some left-overs from installations of previous versions). I was not able able to reproduce it on a clean computer.

I do not think that Excel version plays a role here.

Has the customer attempted it on multiple computers - and some that had not any QuickOPC/OPC Data Client before?

Things are generally difficult when multiple versions are involved, but in addition in some version we may have forgotten to update the references that are inside the Excel files, so they still specify some older versions of the COM type libraries of the product. When just one version is involved, Excel/VBA will use just that version, even if there is a version number mismatch. But when more versions are present, it can all get mixed up.

On a computer where I have seen the same or similar issue, here is what I did to fix it:

1. Open the file in Excel, but without running the code.
2. Developer -> Visual Basic.
3. Tools -> References.
4. In the list of available references, there will be one or two libraries starting with "OPC Labs..." checked. Remember/write down their down, and uncheck them. You may also want to hover over the "Location" at the bottom to see if they point to the right location (it has version# in it) - in my case, the locations were wrong.
5. Press OK to close the dialog.
6. Tools -> References (again).
7. This time scroll down until you find a block with "OPC Labs..." libraries. Check the boxes next to libraries that were originally references (e.g. OPC Labs Base Library Core, and OPC Labs EasyOPC "Classic" Library).
8. Press OK to close the dialog.
9. File -> Save...
10. Close Excel.
11. Open the file in Excel and test.

This has helped in my case. Hopefully it will help you/the customer too. If not, report that back to me (but it would be much more difficult then...)

Please Log in or Create an account to join the conversation.

More
18 Jan 2018 15:32 #5879 by gkalipershad
I was hoping you could shine some light on this situation. A customer reached out to me with the following:

“Running evaluation of OPC Data Client 2017.2 on WIndows 10. .NET Framework > 4.7. I was specifically looking at VBA Examples provided for excel using classic OPC library and COM objects. When I open the SubscribeToMultipleItems.xls spreadsheet, and press SUBSCRIBE button. Excel completely crashes. Stepping through the code, application crashes when the Call Client.SubscribeMultipleItems method is executed.”

They included a document with screenshots, which I have attached. I mentioned to him that these examples were developed and tested in Excel 2007 or 2010, but are saved in Excel 2003 format for compatibility (Taken from Help File). He is using Excel 2013. Would this pose a problem? I experienced similar issues to him on my own PC.

He later came back to me stating:

“Another reference point… I was successful running the example versions for the OPC UA server. These work fine, however I am trying to keep a legacy application alive so I specifically need to be able to connect with OPC DA servers AND use VBA. All the newer capability looks great, but I’m trying to avoid redeveloping these custom applications from scratch.”

What are your thoughts on this? Any input would be greatly appreciated.

Thanks!
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.153 seconds

      

 Recommend this on Google