Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
vb to xl

vb to xl

Ratings: (0)|Views: 9 |Likes:
Published by aravindwin

More info:

Published by: aravindwin on Sep 19, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

01/12/2011

pdf

text

original

 
The following is a step-by-step lesson on how to send data from a VB program to Excelspreadsheet directlyIn this lesson, we will use Ultimaserial ActiveX to develop a data acquisition application withDATAQ's Starter kit.InUltimaSerial download, you will find the VB sample program (AnalogWaveformExel) thatdemonstrates how to send data from VB program to Excel spreadsheet directly.To send data from VB to Excel spreadsheet directly, you need to1) Invoke Excel:Set oExcel = CreateObject("Excel.Application")2) Add a workbook:Set oBook = oExcel.Workbooks.Add 3) Specify a spreadsheet:Set oSheet = oBook.Worksheets(1) 4) Send the data:oSheet.Range(s$).Resize(Val(Text1.Text), 1).Value = dataarray Here is the source code:Dim oExcel As ObjectDim oBook As ObjectDim oSheet As Object'------------------------------------------------------------------------------------------'This program demostrate how to acquire data and display in a scrolling waveform,'you can also send data to excel!''For DI-148/158/710 series support, please visit www.ultimaserial.com first''------------------------------------------------------------------------------------------Private Sub Form_Load()'For DI-148/158/710 series support, please visit www.ultimaserial.com firstList1.AddItem "150RS" 'DevicesList1.AddItem "151RS"List1.AddItem "194"List1.AddItem "195B"List1.AddItem "154RS"List1.AddItem "148U"List1.AddItem "158U"List1.AddItem "710U"List1.AddItem "715U"Combo1.AddItem "1" 'COM port
 
Combo1.AddItem "2"Combo1.AddItem "USB"End SubPrivate Sub Command1_Click()UltimaSerial.Device = Val(List1.Text)UltimaSerial.CommPort = Val(Combo1.Text)UltimaSerial.AcquisitionMode = NoConditionUltimaSerial.ChannelCount = 4UltimaSerial.SampleRate = Val(Text3.Text)UltimaSerial.EventLevel = 2 'Chart it when we have 2 or more points.UltimaSerial.StartLabel4.Caption = "Serial Number: " + UltimaSerial.SerialNumber Text3.Text = UltimaSerial.SampleRateEnd SubPrivate Sub Text1_Change()If Val(Text1.Text) <= 0 Then Text1.Text = 1If Val(Text1.Text) >= 1000 Then Text1.Text= 1000Text1.Text = Int(Val(Text1.Text))s$ = Format$(Val(Text1.Text))Command3.Caption = "Send " + s$ + " data# to Excel!"End SubPrivate Sub UltimaSerial_NewData(ByVal Count As Integer)v = UltimaSerial.GetData() 'Get dataDQChart1.Chart (v) 'Chart all channelsEnd SubPrivate Sub Command2_Click()UltimaSerial.StopEnd SubPrivate Sub Command3_Click()v = UltimaSerial.GetDataFrame(Val(Text1.Text))If CheckReuseSheet.Value = 0 ThenSet oBook = oExcel.Workbooks.AddSet oSheet = oBook.Worksheets(1)ElseSet oSheet = oBook.Worksheets(1)

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->