0% found this document useful (0 votes)
71 views1 page

Example: Using The MS Automation Interface

The document provides 3 examples of using the MS Automation interface to interact with different Microsoft applications. The first example writes an output value from an input field to an Excel table. The second example opens a report from MS Access. The third example opens the Microsoft Internet Explorer and navigates it to a URL, setting the window size and position.

Uploaded by

Royal Board
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views1 page

Example: Using The MS Automation Interface

The document provides 3 examples of using the MS Automation interface to interact with different Microsoft applications. The first example writes an output value from an input field to an Excel table. The second example opens a report from MS Access. The third example opens the Microsoft Internet Explorer and navigates it to a URL, setting the window size and position.

Uploaded by

Royal Board
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Example: Using the MS Automation interface Page 1 of 1

Example: Using the MS Automation interface


Introduction
The following three examples illustrate how to use the MS Automation interface.

Example 1: MS Excel
In this example, an output value from an input field is written in an Excel table.

'VBS113
Dim objExcelApp
Set objExcelApp = CreateObject("Excel.Application")
objExcelApp.Visible = True
'
'ExcelExample.xls is to create before executing this procedure.
'Replace <path> with the real path of the file ExcelExample.xls.
objExcelApp.Workbooks.Open "<path>\ExcelExample.xls"
objExcelApp.Cells(4, 3).Value = ScreenItems("IOField1").OutputValue
objExcelApp.ActiveWorkbook.Save
objExcelApp.Workbooks.Close
objExcelApp.Quit
Set objExcelApp = Nothing

Example 2: MS Access
This example opens a report from MS Access.

'VBS114
Dim objAccessApp
Set objAccessApp = CreateObject("Access.Application")
objAccessApp.Visible = True
'
'DbSample.mdb and RPT_WINCC_DATA have to create before executing
'this procedure.
'Replace <path> with the real path of the database DbSample.mdb.
objAccessApp.OpenCurrentDatabase "<path>\DbSample.mdb", False
objAccessApp.DoCmd.OpenReport "RPT_WINCC_DATA", 2
objAccessApp.CloseCurrentDatabase
Set objAccessApp = Nothing

Example 3: MS Internet Explorer


This example opens the MS IE.

'VBS115
Dim objIE
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate "http://www.siemens.de"
Do
Loop While objIE.Busy
objIE.Resizable = True
objIE.Width = 500
objIE.Height = 500
objIE.Left = 0
objIE.Top = 0
objIE.Visible = True

mk:@MSITStore:C:\Program%20Files\Siemens\WinCC\documents\English\VBScripts... 4/30/2013

You might also like