473,387 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to gather data via RS 232 and import it to Excel using VBA

I have a Fluke 45 series multimeter. I would like to gather data from it through MS Excel and VBA. I have no trouble sending commands to the multimeter but I cannot figure out how to read data from the output buffer. I am going to go learn about MSCOMM32.OCX and see if it will be helpful. Any other suggestions would be great. Thanks in advance.

Joe
Oct 23 '06 #1
3 29214
albertw
267 100+
I have a Fluke 45 series multimeter. I would like to gather data from it through MS Excel and VBA. I have no trouble sending commands to the multimeter but I cannot figure out how to read data from the output buffer. I am going to go learn about MSCOMM32.OCX and see if it will be helpful. Any other suggestions would be great. Thanks in advance.

Joe
hi
an example of how to save incoming data from rs232
you may have to change settings and/or options because i don't know the specific format in which your device is sending data.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. ' chose correct settings for your device
  3. Settings = "9600,n,8,1"
  4. MSComm1.Settings = Settings
  5. MSComm1.Commport = 1
  6.  
  7. With MSComm1
  8. ' receive chr by chr
  9.     .InputLen = 1
  10.     .RThreshold = 0
  11.     .SThreshold = 0
  12.     .InBufferSize = 10240       '10kb
  13.     .InputMode = comInputModeText
  14.     .Handshaking = 0            'None
  15. End With
  16. End Sub
  17.  
  18. Private Sub Receive()
  19. FileName = App.Path & "\RS232.dat"
  20. Open FileName For Output As #1
  21.     Do
  22.     DoEvents
  23.     RxTxt = MSComm1.Input
  24. ' start capture if you get some input
  25. ' you may also wait for some other specific character
  26.     Loop Until RxTxt > vbNullString
  27.     inbuff = vbNullString
  28.  
  29.     Do
  30.     DoEvents
  31.     RxTxt = MSComm1.Input
  32. ' data is supposed to be separated by Chr(10)
  33. ' chose another separationmark if neccesary
  34.         If RxTxt = Chr(10) And Len(inbuff) > 0 Then
  35.             If Left(inbuff, 1) = Chr(10) Then inbuff = Right(inbuff, Len(inbuff) - 1)
  36.             Print #1, inbuff
  37.             inbuff = vbNullString
  38.         Else
  39.             If Len(RxTxt) > 0 Then
  40.             inbuff = inbuff + RxTxt
  41.             End If
  42.         End If
  43. ' data is supposed to end with Chr(3)
  44. ' chose another endmark if neccesary
  45.     Loop Until RxTxt = Chr(3)
  46. Close
  47. End Sub
  48.  
Oct 23 '06 #2
Thanks... very helpful
Oct 24 '06 #3
tqm1
1
Dear Sir,

Your codes save mscomm data to the following file.
FileName = App.Path & "\RS232.dat"

But I want to show the data into listbox

Please help
Jun 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Soundneedle | last post by:
(AC2003, XL2003) Can anyone explain how I can get the transferspreadsheet function to upload a sheet that has number for the field names? Access converts the field header to "F##". In other...
1
by: duha | last post by:
Dear All, how I can read data from excel file using php I want convert some data which stored in Excel file to mysql using PHP Regards Duha
1
by: winmani | last post by:
hi buddies, cud u explain, how to retrieve data from excel file and save into oracle database using vb.net.
5
by: Chase Kang #52 | last post by:
Using VB.NET, I've created a report that takes data from a stored procedure, which goes into some aspx page controls, and inserts that data into a pre-formatted Excel spreadsheet template by using...
3
by: balazee | last post by:
Hi, I’ve some data in an excel sheet which needs to be displayed in an html page as lists. For example, In the excel I’ve the below details like, the application name and the path where the...
2
by: VENKATAKRISHNA | last post by:
i want to read data from excel using c and use tht data for further excecutation in my code how can i do it
1
by: vijaymohan | last post by:
Hi ..I am very new to perl..can some one help me with this script pls.. I am Querying database and writing data to excel.. Here is my script: #!/usr/bin/perl -w use strict; use DBI;
0
by: romcab | last post by:
Hi guys, I would like to ask how can I get an entire row of data in excel using .net? right now what I can retrieve is 1 column but what I want is all of the column on the entire row. What I...
2
by: ranjiths | last post by:
hi, i am trying to export data to excel from html using javascript, but i am getting an error as it opens saveas window. Please do the needful
1
by: =?Utf-8?B?U2hlZXMgQWJpZGk=?= | last post by:
I read an article on the link: http://support.microsoft.com/default.aspx?scid=kb;en-us;306572 related to reading data from Excel using OLEDB The topic's heading is: How to query and display excel...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.