Back

Topic

[KB149]How to Start an Excel Macro with a SCADA BASIC Instruction

Tags: Scada Basic, Scripting

14 years ago
By RM
Options
Print
Applies to:

PcVue all versions.


Summary:

This article shows how you can start a macro with a SCADA BASIC instruction in PcVue.


Details:

For the example below, Excel must already be running and worksheet Sheet1 open. You can call this function by an event, button or other means.

Write the following code in your SCADA BASIC program.

Sub StartMacro ()

  Dim Handle as Long;
Handle = DDE (“INITIATE”, “EXCEL”, “Sheet1.xls”);
print (handle);
DDE(“EXECUTE”,Handle,”[EXECUTER(\”Macro1\”)]”);
DDE(“TERMINATE”,Handle);

End Sub


Created on: 05 Nov 2010 Last update: 26 Aug 2024