Controlling Microsoft Excel from Scripting

You can also control Excel and run Excel macros from within Aurora scripting.  The following is a sample script which runs an Excel macro.  The Import statements “Imports Microsoft.Office.Interop” and “Imports Microsoft.VisualBasic” must be included in the script to create an Excel application object. 

Imports System

Imports Microsoft.VisualBasic

Imports AURORAServer

Imports AuroraServer.Options

Imports EnergyExemplar.Aurora.ParameterSets.Parameters

Imports Microsoft.Office.Interop

Class AuroraScript

    Shared AC As ComApplication = VB_RemoteAPI.InitializeAC()

    Shared ADS As ComDataSet = VB_RemoteAPI.InitializeADS()

    Shared Sub Main()

        Dim xlApp As Excel.Application

        Dim xlBook As Excel.Workbook

        Dim xlSheet As Excel.WorkSheet

        xlApp = CreateObject("Excel.Application")

        xlBook = xlApp.Workbooks.Add

        xlSheet = xlBook.Worksheets(1)

    End Sub

End Class


Aurora can be controlled from Excel (and other applications) using VBA, as well as VB .Net. Refer to Scripting Aurora from Microsoft Excel for specific commands and instructions.

Scripting

Controlling Microsoft Excel from Scripting


For further assistance, please contact Aurora Support.

Copyright© 1997-2024 Energy Exemplar LLC. All rights reserved.