Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
OPC UA VBA Com Object Connection Management
I hunted this for 2 hours, and it really looked like that for some unknown reason, VBA does not accept the service name string that VBScript does.
But, in the end, I found that the cause was different: The service name is case sensitive, and you have a typo there as well.
Best regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
before I investigate deeper, how comes that there is the double "s" in "SServices" in "Error Message: Could not load type 'OPCLabs.EasyOpc.UA.SServices.IEasyUAClientConnectionControl' from assembly 'OpcLabs.EasyOpcUA'." ? Is that a typo in your post here, or is that really the precise text of the error message? The service name in the code that you posted, however, looks OK.
Regards
Please Log in or Create an account to join the conversation.
"Critical Error #-2146233054"
"Error Message: Could not load type 'OPCLabs.EasyOpc.UA.SServices.IEasyUAClientConnectionControl' from assembly 'OpcLabs.EasyOpcUA'."
I assume the literal string used in the vbScipt example needs to be changed when this method is implemented in VBA. Can you let me know the correct service name string to use in VBA?
Here's my VBA connection control code, error occurs in ua_ConnectToUaAServer() on the call to isg_OpcUaClient.GetServiceByName()...
Please Log in or Create an account to join the conversation.
here is VBScript example for the same, which is closer to VBA.
It looks long, but that is only because it also hooks to "connection monitoring" in order to demonstrate what is happening under the hood. In reality, you need just these two or three parts:
Please Log in or Create an account to join the conversation.
Can you provide some syntax guidance for instantiating and setting / clearing the lock property in VBA? I don't need a full example, just some code snippets would be very helpful.
Thanks!
Please Log in or Create an account to join the conversation.
QuickOPC keeps the connection open (and reuses it) for configurable time after the last operation (5 seconds is the default); it also keeps it open as long as there are any subscriptions. So, if you are doing the reads&writes in quick succession, your assumption (" I assume connecting to and then disconnecting from the OPC UA endpoint with each call") would be incorrect. But, if it the user initiating them, infrequently, then the connection could be closed and reopened and that can slow down the operations.
1) One way to deal with it is to increase the "hold period" to a larger value, potentially very large.
2) Another option is to "lock" the connection explicitly:
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...tion%20Control%20Services.html
- opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...20unlock%20a%20connection.html
Unfortunately there is no VBA example currently, but if you decided to go this way, we can prepare one if needed.
3) A "poor-man" option is also to subscribe to anything (a non-existent node would do), and keep the subscription (no need to process the incoming data) as long as you want the connection be maintained.
I hope this helps
Please Log in or Create an account to join the conversation.
Based on the provided examples, I have been using the easyUAClient object’s read and write methods, but these are a bit slow and seem to have a lot of overhead, I assume connecting to and then disconnecting from the OPC UA endpoint with each call. During a given upload or download operation, my VBA code will potentially need to read thousands of tags and make many different calls to read and write operations as part of handshaking operations. I have been looking through the online documentation, but haven’t figured out the most efficient way to process these reads/writes.
I would prefer to make and maintain a single OPC UA Connection to a given endpoint and then be able to issue reads and writes on demand. It appears there is a built in hold period that will determine how long the easyUAClient will maintain a connection. I also have seen there is a UASmartSessionParameters Object in the API, but it is not clear how to utilize this in the VBA code for a given instance of an easyUAClient. Is there anyway to set the client to hold a connection indefinately until I issue a call to disconnect or set the client object reference to Nothing? Generally, can you give me some examples showing how I can control the client connection to the server in Excel VBA?
Thanks
Please Log in or Create an account to join the conversation.