Promotic

Examples of the work with applications Excel

The application solves data write into the Excel application.

- This example is functional for the Web.
- Located in the Pma objects tree: /Examples/Database/Excel.


The Excel folder contains panel Panel1. The button script methods are located on the "Methods" tab of the PmaPanel object named "ExcelReadFromPm", "PmWriteToExcel" and "ReadDataFromDB". The particular xls files can be found in the application folder in Excel subfolder.
The three examples solve:
a) Open the Excel application followed by launching macro of this application (file: ExcelReadFromPmTemplate.xls).
In this example (ExcelReadFromPm designer's method) the AxGetObject method opens the ExcelReadFromPmTemplate.xls file and then a macro named "ReadFromXm" contained in the Excel application is launched by means of the "Application.Run" method. The macro contains a script, that is read via XMLDOM XML data offered by a Web server of the PROMOTIC application.
(The script is available after opening the file in the Excel environment by opening the Visual Basic language editor Alt+F11)
The disadvantage of this solution is the necessary decreasing of security level in the Excel environment allowing launching the macros.
b) Open the Excel application and write values into it (file: PmWriteToExcelTemplate.xls).
In this example (PmWriteToExcel designer's method) the AxGetObject method opens the PmWriteToExcelTemplate.xls file. This is followed by the script processing all the demanded operations.
The advantage of this solution is that the Excel file does not have to contain any macros.
The disadvantage is that when processing large data volumes into Excel the writing is time consuming. This way the running of other parts of the PROMOTIC application can be limited.
c) Open the Excel application, read the data from database (file: ReadDataFromDB.xls, DBData.dbf, DBData.csv).
In this example (ReadDataFromDB designer's method) the Pm.ShellExecute method opens the ReadDataFromDB.xls file (this application is independent on the PROMOTIC system).
This application solves reading the data from a database of the dbf type or from CSV file.
(The script is available after opening the file in the Excel environment by opening the Visual Basic language editor Alt+F11)
Detailed example description Example of reading data from external databases in MsExcel
d) Reading the data into the PmgWTable object from a database (the DataExcel.xls file) by means of the PmaAdo object.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.