AdvancedHMI can definitely do this. Here are some steps to get you started:
- Open the AdvancedHMI project with Visual Studio
- Right Click the AdvancedHMI project in Solution Explorer and select Properties
- Select the References Tab
- Click Add Reference
- On the COM tab, locate Microsoft Excel Object Library, and then check the box
- In Solution Explorer, double click MainForm.vb
- Build the Solution from the Build menu
- In the Toolbox, go to the AdvancedHMIDrivers group and add an EthernetIPforCLXCom to the form
- In the properties window, set the IPAddress to the address of your PLC
- From the ToolBox, add a DataSubscriber to your form
- In the Properties Window, set PLCAddressValue to the BOOL tag name in the PLCwhere you want to trigger the print
- Double click on the DataSubscriber to get back to the code
- Enter this code:
Code:
if e.values(0)="True" then
Dim oXL As Microsoft.Office.Interop.Excel.Application
' Start Excel and get Application object.
oXL = CreateObject("Excel.Application")
oXL.Visible = True
oXL.Workbooks.Open("MyExcelFile.xlsx")
oXL.Worksheets.PrintOutEx()
End If
I have not been able to completely test this right now, but let me know if there is any problem and I will do a full test this evening. Since AdvancedHMI sits on top of the .NET framework, there is a huge amount of information on this topic, just Google ".NET Excel Automation"