Back

Topic

[KB135]Launching an Excel workbook using an Enable Basic script

Tags: Enable, Scripting, VBA

14 years ago
By RM
Options
Print
Applies to:

PcVue version 7.00 onwards.
This article contains obsolete references.


Summary:

This article describes how to launch a Microsoft Excel workbook using an Enable Basic script.


Details:

The sample bilingual attach file project shows how to launch an Excel workbook and worksheet using the OLE Automation object EXCEL.APPLICATION.

Example

Private Sub excel1()
Dim MonXl As Object
Dim feuille As String
Set MonXl = CreateObject(“Excel.Application”)              ‘ worksheet name coming from a PcVue TEXT variable
feuille = TheseVariables.Item(“NomFeuil”).value           ‘ workbook name to select coming from a PcVue TEXT variable
MonXl.WorkBooks.open TheseVariables.Item(“NomClasseur”).value
Monxl.ActiveWorkbook.Sheets(feuille).select                 ‘ text to write in the R1C1 cell, coming from a PcVue TEXT variable
MonXl.ActiveCell.FormulaR1C1 =TheseVariables.Item(“ContenuClasseur”).value ‘ To show the active workbook
MonXl.Visible = True                                                           ‘ To free the pointer
Set MonXl = Nothing
End Sub

Download attachments: excel.zip

Note

You will need to enter the path for the sample spreadsheet TEST.XLS in the Excel project. (Here the default in the mimic is: C:\Programs\PcVue\710c\Usr\excel\tp).)


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