Example Script : Script for running macro within the Excel
'This script runs the macro within the Excel.
Imports System 'Necessary classes imported
Imports System.IO
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Namespace WinTr
Public Class MainClass
Public Sub Load 'Load procedure is defining. Script
'starts working within this procedure.
'WinTr tags should be
'accessed from this procedure.
'When this procedure finished working,
'WinTr tags can not be reached anymore from this script.
Dim Exl As Microsoft.Office.Interop.Excel.Application
Try
Exl = New Microsoft.Office.Interop.Excel.Application
Exl.Visible = True
Exl.Workbooks.Open("C:\Book1.xls")
Exl.Worksheets(1).cells(1, 1).value = "Date"
Exl.Worksheets(1).cells(2, 1).value = Now
'Queryread procedure executing which inside the Sheet1 named page.
Exl.Run ("Sheet1.Queryread")
Catch ex As Exception
MessageBox.Show(Ex.ToString,Ex.Message)
MsgBox("C:\Book1.xls")
End Try
End Sub
End Class
End Namespace