Access OPC Data From VBA
With QuickOPC, you can access real-time process data from Visual Basic for Applications (VBA), and even control your process by writing into OPC items. You can use VBA to create live reports, or pull data from the application and use them as input to your control systems. OPC VBA solutions like this provide high value by combining computational and presentation capabilities of VBA applications with real-time OPC data.
How does QuickOPC allow integration of OPC data from VBA?
- QuickOPC provides COM objects with easy interfaces to perform all kinds of OPC tasks
- You reference the QuickOPC objects from a code written in Visual Basic for Applications (VBA) and embedded in your solution.
- You call methods that perform operations such as OPC reading or writing.
VBA with QuickOPC can be used to bring OPC data to Excel. Doing so is very powerful, but it requires programming knowledge (and is thus not suitable for a typical Excel user). If you do not need VBA for other purposes or for further processing of OPC data, it is much easier to set up a communication link between Excel and any OPC server using our Excel Connector.
The Excel Connector requires no programming, and the user can create spreadsheets with live, animated OPC data with just drag-and-drop.
If you want see it for yourself, we have an OPC Excel example that shows how to create a simple worksheet with one OPC item, and read its value upon opening the worksheet. The result looks like this:
The example connects to Simulation OPC Server, but you can quickly modify it to connect to your OPC server instead. Simply download the product and then open the project, or follow the tutorial (for OPC Data Access):
It is also possible to communicate with OPC Unified Architecture (OPC UA) servers from VBA. The corresponding example is included with the product, and you can read about the few steps needed to achieve this in the knowledge base article below.
The PubSub variety of OPC UA (as opposed to client-server) uses message-oriented middleware to deliver the data. QuickOPC supports it as well. Code example is available in the documentation, and installed with the product.
Footnote & required disclosure: QuickOPC (including its Options) is a software development kit (SDK) for development of OPC clients and subscribers. Installing QuickOPC or its Options does not change system settings.