I'm looking for a way to communicate through the serial port while in Excel. I used to use Excel 2003, and had MSComm objects setup to work within my code. With these objects, I was able to trap on incomming comm events and parse any new data that was coming from the serial port. However, when I moved over to Excl 2007, the MSComm object seems to have gone away, and I can't find any.
![]() --> DefinitionExceptions
Access is denied to the port.
-or-
The current process, or another process on the system, already has the specified COM port open either by a SerialPort instance or in unmanaged code.
One or more of the properties for this instance are invalid. For example, the Parity, DataBits, or Handshake properties are not valid values; the BaudRate is less than or equal to zero; the ReadTimeout or WriteTimeout property is less than zero and is not InfiniteTimeout.
The port name does not begin with 'COM'.
-or-
The file type of the port is not supported.
The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this SerialPort object were invalid.
The specified port on the current instance of the SerialPort is already open.
Examples
The following code example demonstrates the use of the SerialPort class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the SerialPort class.
Remarks![]()
Only one open connection can exist per SerialPort object.
The best practice for any application is to wait for some amount of time after calling the Close method before attempting to call the Open method, as the port may not be closed instantly.
Security
SecurityPermission
for calling unmanaged code. Associated enumeration: UnmanagedCode Security action: LinkDemand Applies toVB6 MSCOMM Port 20 Can't ConnectVB6 MSCOMM Port 20 Can't Connect
Help! I'm using VB6, and am trying to use MSCOMM to connect to a USB to SERIAL Port, COM20. VB6 Won't connect to it! Device Manager lists it as Com20. A port enumerator lists Com20 as present. WIN XP Hyperterminal can connect to it, and show the data I'm uploading from a microcontroller. I am trying to use VB6 to read and process the data from the microcontroller. I have used MSCOMM before, always with low port numbers, eg COM2, and it works fine. The USB to Serial module is a FTDI UB232R which uses the FT232RQ, and I am using the new, combined driver, 2.00. >>> VB6 doesn't seem to find the higher ports! <<< Have others seen this problem? Is there a solution? Thank you, JC ![]() Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |