MSCOMM32 Control in Excel 2003 VBA - Control Stopped working!!!
On Feb 25, 9:20*pm, tomcee wrote:
On Feb 24, 8:46*pm, tomcee wrote:
On Feb 20, 11:30*am, tomcee wrote:
On Feb 20, 10:38*am, tomcee wrote:
I am experiencing very strange behaviour with the MScomm32 control in
Excel 2003 VBA.
The control is registered, and I can install it in my spreadsheet, but
when running (via Sub Worksheet Change), it appears to execute once (I
have a Belkin USB/RS232 adaptor which has status and TX/RX LEDs).
On successive executions, I get error messages that the port is
already open (I do set the PortOpen property to False at the end of
each run), but if I do not execute the .portopen to true, it returns
an error saying the port is not open!).
I am using MSCOMM32.ocx version 7-26-95, I believe installed with my
VB4.
Also, I notice that when I exit Excel, the status LED on the USB/RS232
adaptor blinks.
It seems to me that there is some setting in the com port status that
I am not maintaining or Set/resetting in the correct order.
Thanks in advance for your assistance!
TomC
--------------------------------------------------------
Here is my code:
[obviously with some commented remnants of my failed attempts.]
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MSComm1.Enabled = True
'MSComm1.PortOpen = False
MSComm1.Activate
'MSComm1.PortOpen = False
'MSComm1.PortOpen = False
MSComm1.PortOpen = True
MSComm1.Settings = "9600,N,8,1"
MSComm1.Handshaking = NoHandshaking
'MSComm1.PortOpen = True
MSComm1.Output = "Hello out there!"
MSComm1.PortOpen = False
'MSComm1.Delete
End Sub
Fwiw:
I found that my VB4 has the same issue!!!
So, I installed this mscomm32.ocx:
===========================
mscomm32.ocx 103744 6-24-98
and registered it via:
regsvr32 c:\windows\system32\mscomm32.ocx
and things seem to work fine in Excel2003 !!!
It also fixed the issue in VB4!!!
It appears that there was a port close issue with the older
mscomm32.ocx that I was using!
Cheers!!TomC- Hide quoted text -
- Show quoted text -
So,....a few days ago, things were working fine.
Today when I try to open this excel sheet, I get an error message that
says,"Can't exit design mode because control MSCOMM1 can not be
created'.
So now I no longer can access the serial ports!!!
I've tried re-registering the control, both through Excel and from the
Run prompt.
Anyone have an idea what is going on?
Thanks in advance!TomC- Hide quoted text -
- Show quoted text -
I suspect some strange problem between Excel 2003 and the mscomm
contol I was using.
I'm puzzled why it had worked for a while and then would not work. *Is
my registry perhaps corrupted?
Any ideas?
TIA,tomc- Hide quoted text -
- Show quoted text -
Any help? If I should post this in a different group, please let me
know!
Thanks,
TomC
|