Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
4 ratings:
 2.75 out of 5     Rate this Document

Loading Excel Data into DIAdem Programmatically Using VBScript



Primary Software:
Primary Software Version: 8.10
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
How do I load data from Excel programmatically using DIAdem's VBScript interface?

Solution:
Using the Excel import wizard allows you to interactively load Excel data into DIAdem, however it is also possible to do this programmatically using VBScript.

In order to use a script to load Excel data you need to first create a *.STP, or setup file that describes how the XLS file is interpreted. You create the *.STP file by using the Excel import wizard one time, and saving the configuration file.

The following code is programmed to load the Excel file WaterFall.XLS using the Waterfall.STP file. (files are attached)

Call LoadExcelData(AutoActPath & "Waterfall.XLS", AutoActPath & "Waterfall.STP", 0)

Sub LoadExcelData(ExcelFilePath, ExcelSTPFilePath, ShowDialog)
Call DataDelAll ' clear all previous DATA channels
Call MsgBoxDisp("Loading Excel data...", "MB_NOBUTTON" , "MsgTypeNote", 0, 0, 1)
Call ExcelReset ' reset all the Excel Import parameters
Call ExcelImport(ExcelFilePath, "Sheet1", ShowDialog, ExcelSTPFilePath)
Call MsgBoxCancel
IF ExcelStat <> 0 THEN Call AutoQuit("Error encountered during Excel File import")
End Sub ' LoadExcelData()


Detach the 3 files “Excel Example.VBS”, “Waterfall.STP”, and “WaterFall.XLS” into the same directory and run the script “Excel Example.VBS

Related Links:
KnowledgeBase 2KN9IMFN: VBScript in DIAdem

Attachments:


Waterfall.STPWaterfall.XLSExcel Example.VBS


Report Date: 11/08/2002
Last Updated: 03/19/2009
Document ID: 2R76M7ZL

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit