Latest version of pmbok. Explore this ArticleInstall Software (Establish RS232 & DDE Communication)Bill Redirect Software (General Configuration)Bill Redirect Software (RS232 Serial Port configuration)Microsoft Excel (General Configuration)Excel Plugin ConfigurationSeveral Option Are AvailableShow 3 more..Show less..Ask a QuestionRelated ArticlesReferences
- I am trying to write a simple VBA macro that reads Text data from a Serial port and puts it into an Excel 2003 spread sheet. The solution needs to work from a standard installation of Office 2003. I cannot use add-in modules since the envrioment has been locked by the SysAdmin.
- Re: Serial Port Communications within Excel I know this is an old post but this may be of use to someone, could not get mscomm32 to work and eventually stumbled on to an ocx file called NETComm, this is a free download and must be registered under the system32 directory in win 7 64bit.
- Apr 04, 2006 CheapComm was written to permit Visual Basic, Excel, and VBA (Visual Basic for Applications) users to use the Photon Technology International (PTI) serial port devices without requiring purchase of the professional version of Visual Basic (that comes with MSCOMM32, a decent serial port OCX), or an expensive serial port DLL that provides many more features than the SIDs require.
Serial To Excel VBA without MSCOMM. Ask Question. Win32api for serial communication in excel VBA. Serial Port Communication - Receiving data from device. The art of RS232 communication with Excel is particularly satisfying, as the data that one gets from an instrument almost always ends up in Excel in the end. It is therefore much more elegant to import your data directly into Excel.I have got loads of programs which not only monitor industrial instruments, but notify users by e-mail (including Lotus Notes.) automatically if the data exceeds a particular limit.
Excel Vba Tutorials For Beginners
wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 13 people, some anonymous, worked to edit and improve it over time. This article has also been viewed 13,600 times. Learn more..
This tutorial explains how to establish a bidirectional real-time communication between Microsoft Excel and your RS232 COM Port devices like a Scale, Proximity reader, Barcode reader, temperature sensor, Caliper, Micrometer, Gage. This solution uses the software 'Bill Redirect' with the 'Excel Plugin' to easily connect your peripheral and receive and send the data. The communication between Microsoft Excel and your device is made via a direct DDE link. An Excel Macro can be called after each data received from your device to validate the data received. This solution explains how you can send a command via VBA to your device and totally control your device. No programming or additional hardware required!
Active8 months ago
What is the best way to access a serial port from VBA?
I have a need for some of our sales reps to be able to send a simple string over the serial port from an action button in PowerPoint. I don't commonly use VBA, especially for anything like this. Normally I would turn it into an application of some sort, but I actually don't think the idea is that bad. It will be a handy tool for them to demo this device with while on a projector and talking to other sales guys and non technical people. Also, this sales guy will have no problem making small modifications to the VBA or PowerPoint presentation, but would not do as well with recompiling a .NET application.
Serial numbers on gibson les paul. I know we could do it through a batch file run from the presentation on the action, but that doesn't make me very happy. I figure we could probably access a COM object and run from there, but again I am not real up on the latest and greatest libraries to use in VBA, and it would also be nice to get a quick little primer in how to easily open, send and close the connection.
Since this will need to be run on multiple people's computers, it would be nice if it would be easily transportable to other machines. I should be able to say it has to run on Office 2007 and Windows XP. Compatibility with anything else would be a nice bonus though.
How should I go about handling this? Any good tips or tricks? Library recommendations?
GEOCHET
GEOCHETGEOCHET19k1515 gold badges6868 silver badges9494 bronze badges
3 Answers
The Win32 API handles the serial port as a file. You can access the serial ports directly by calling these API functions from within VBA. I had to do this for an old .NET application but VBA is no different.
Rather than hash it out for you on this site, here's a reference I've hung onto over the years. How to perform serial port communications in VBA
Some CanuckSome Canuck
This works for me. I'm not sure if the OPEN actually sets up the Baud rate, as I first used TeraTerm.My COM port is a USB connection to a BASYS3 prototyping kit. It is spewing characters at 9600, records of 36 characters ending with CR. I can randomly send commands of 9 characters. In the above code, I generate these command strings every time I have received a new line.The way I chose which character to send is a little clunky: perhaps a better way is to have a character pointer and a number of characters, and when those go equal to set them both to zero.
ppovoski2,18233 gold badges1616 silver badges2525 bronze badges
Jeff KaylinJeff Kaylin
Here is a brief module of VBA code that can send and receive messages on a PC serial port. This is not very elegant, but it is simple and should work on modern versions of Excel and Windows.
You are left on your own to expand the functionality and store or parse the messages. This just shows the low-level stuff to deal with the serial port.
The first 5 lines declare the millisecond 'Sleep' library function (based on Excel version).
The SerialPort() subroutine outlines the steps to open the port, transmit some data, receive some data, try again to receive some data (to show that it really does not run afoul of the 'end of file' error), and close the port.
user3899443user3899443