Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to use VBA read and write to a serial port
for use in/from Excel? Where can I look at sample code to learn how it is done? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Wal,
Not directly but you can use API functions: API Function: Description: CreateFile() opens a specific communications port. SetCommState() sets the state of the serial port in question (baud rate, parity, stop bits etc.) GetCommState() retrieves the state of the serial port in question (baud rate, parity, stop bits etc.) ReadFile() reads data from a port. Can be specified to return immediately or wait for incoming data. WriteFile() writes data to the serial port. MP "Wal" a écrit dans le message de ... Is it possible to use VBA read and write to a serial port for use in/from Excel? Where can I look at sample code to learn how it is done? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks MP, but I don't understand what you mean.
Could you please explain a bit more simply or tell me where I could read up on how to do this. I can't find any help in VBA about the functions you suggest. If it can't be done directly in VAB do I need to write and run code outside Excel's VBA? I have read serial port data on an Apple II computer many years ago so I know a tiny bit, but I don't where to start with VBA for use in or with Excel. -----Original Message----- Hi Wal, Not directly but you can use API functions: API Function: Description: CreateFile() opens a specific communications port. SetCommState() sets the state of the serial port in question (baud rate, parity, stop bits etc.) GetCommState() retrieves the state of the serial port in question (baud rate, parity, stop bits etc.) ReadFile() reads data from a port. Can be specified to return immediately or wait for incoming data. WriteFile() writes data to the serial port. MP "Wal" a écrit dans le message de ... Is it possible to use VBA read and write to a serial port for use in/from Excel? Where can I look at sample code to learn how it is done? . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Wal,
You can use specific component MSCOMM32.OCX: 1. Open Excel 2. Open Visual Basic Editor 3. RightClick somewhere on Project tree (usually on the left) - Insert - UserForm 4. From the menu - Tools - References - Microsoft Com Control 6.0 (MSCOMM32.OCX) - or click browse and point the file. 5. RightClick somewhere on Project tree (usually on the left) - Insert - Module 6. write sub or func that declare variable from type MSCommLib.MSComm. Regards, MP "Wal" a écrit dans le message de ... Thanks MP, but I don't understand what you mean. Could you please explain a bit more simply or tell me where I could read up on how to do this. I can't find any help in VBA about the functions you suggest. If it can't be done directly in VAB do I need to write and run code outside Excel's VBA? I have read serial port data on an Apple II computer many years ago so I know a tiny bit, but I don't where to start with VBA for use in or with Excel. -----Original Message----- Hi Wal, Not directly but you can use API functions: API Function: Description: CreateFile() opens a specific communications port. SetCommState() sets the state of the serial port in question (baud rate, parity, stop bits etc.) GetCommState() retrieves the state of the serial port in question (baud rate, parity, stop bits etc.) ReadFile() reads data from a port. Can be specified to return immediately or wait for incoming data. WriteFile() writes data to the serial port. MP "Wal" a écrit dans le message de ... Is it possible to use VBA read and write to a serial port for use in/from Excel? Where can I look at sample code to learn how it is done? . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excel does not come with the MSComm ActiveX control- it is provided
with Visual Studio 6. If you have it on your system but do not have Visual Studio 6 installed, it also will not work because you do not have a license to use it. The easiest way to get serial data into an Excel spreadsheet would be to use a 3rd party tool like WinWedge from TALtech. WinWedge is an executable program that runs in the background and feeds serial data directly to other programs either by stuffing the keyboard buffer or by passing the data to other programs using Dynamic Data Exchange (DDE). It also supports sending data out a serial port as well. For more information about WinWedge please visit: http://www.taltech.com/products/winwedge.html On Wed, 6 Oct 2004 18:54:24 -0700, "Wal" wrote: Is it possible to use VBA read and write to a serial port for use in/from Excel? Where can I look at sample code to learn how it is done? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Another option is to use the ActiveX control CheapComm. You can
download the installer at: http://ourworld.compuserve.com/homep...r/software.htm I've put it on Excel 2000 and it seems to work OK so far, but I'm still struggling with deciphering the code from the GPS download sheet that is also available at the above site to make it work for my application. If any of the groups gurus have any insights or sample code, any feedback would be appreciated. On Mon, 25 Oct 2004 15:29:44 GMT, Thomas Lutz wrote: Excel does not come with the MSComm ActiveX control- it is provided with Visual Studio 6. If you have it on your system but do not have Visual Studio 6 installed, it also will not work because you do not have a license to use it. The easiest way to get serial data into an Excel spreadsheet would be to use a 3rd party tool like WinWedge from TALtech. WinWedge is an executable program that runs in the background and feeds serial data directly to other programs either by stuffing the keyboard buffer or by passing the data to other programs using Dynamic Data Exchange (DDE). It also supports sending data out a serial port as well. For more information about WinWedge please visit: http://www.taltech.com/products/winwedge.html On Wed, 6 Oct 2004 18:54:24 -0700, "Wal" wrote: Is it possible to use VBA read and write to a serial port for use in/from Excel? Where can I look at sample code to learn how it is done? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Serial port interface | Excel Programming | |||
serial port data acquisition | Excel Programming | |||
Mac Serial Port Communication | Excel Programming | |||
Excel and the Serial Port | Excel Programming | |||
serial port mscomm32.ocx in excel | Excel Programming |