Avatar of Eamon
Eamon
Flag for Ireland asked on

MSCOMM

Why does this work on my computer

Dim MSComm1 As Object
Set MSComm1 = CreateObject("MSCOMMLib.MSComm")

but it does not work on another computer that has MSCOMM32.OCX in the system32 folder and it is registered.

I get an error Activex component cannot create object.

I do not want to add a reference to the Microsoft Comm Control 6.0 because this would cause errors on other computers that do not have the OCX.

Visual Basic ClassicMicrosoft Access

Avatar of undefined
Last Comment
Eamon

8/22/2022 - Mon
Scott McDaniel (EE MVE )

Are you certain this is the code that is causing the problem?

If so, you may have an issue with that control. Have you tried re-registering the control, or re-installing the redistribution package for those controls?

rockiroads

I know it may be registered, perhaps there is a problem with it though, have you tried to unregister then register again?  regsvr32 /u to unregister
rockiroads

blimey, not again, lol!
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Eamon

ASKER
I have put it on 8 computers in one of our stores. I did not work on any of them. It could hardly be a problem with all 8.
I will try anyway just to make sure.

I have vb6 installed on my computer could this be why it is working on mine and not the others.

rockiroads

ok, I was thinking it was just one when u said another computer

Is the the same version of that ocx? you could copy yours onto there, into a different directory to win\system32 then try to register that.
Eamon

ASKER
Tried the unregister then register again did not work.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Eamon

ASKER
Could it be something stupid like that  MSCOMMLib.MSComm isn't MSCOMM32.OCX
Will try copying my file
rockiroads

You should expect the unexpected and not assume users will have it. What I have tended to do is copy all the libs I use into the local directory where app is installed then register it.
Eamon

ASKER
They have my ocx file now and still no good
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
rockiroads

so u unregistered the existing one
then registered this newly created copy?
rockiroads

whats the error code, is it 429?
Eamon

ASKER
yes 429
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Eamon

ASKER
Have just noticed in the store that when I go to add a reference to the ocx that it is not in the list (see jpg)
I had to browse to the ocx.
Is it registered correctly or is there something else I need to do.

I have another program that tries to make sure that each computer has the required files.
It does the following

FileCopy "\\server\c\epos\updates\OCX\*.*", "c:\WINDOWS\system32\*.*"
                 
Shell ("regsvr32 /s mswinsck.ocx")
Shell ("regsvr32 /s MSCOMM32.OCX")
Shell ("regsvr32 /s MSINET.OCX")
Shell ("regsvr32 /s cgPrint") ' this is my own dll


Could this be causing a problem. Also can you have the same file in two different folders registered.
What I mean is could mscomm be somewhere else on the computer and registered.
Comm.jpg
Eamon

ASKER
I browsed to c:\windowa\system32\mscomm32.ocx and added the reference but I still get the error.

I have a a small test mdb that has the comm control on a form and tried that and that worked.
It must be just something stupid I am doing.
Surone1

what is the purpose of it? kicking a cash drawer?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Surone1

if so you may want to look at this :


Shell "cmd /c echo p0  > LPT1:", vbHide

Open in new window

ASKER CERTIFIED SOLUTION
rockiroads

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Eamon

ASKER
This is what it is used for a Customer Display.

Public Sub CustDisplayInitialize()
On Error GoTo errhandler

Dim MSComm1 As Object
Set MSComm1 = CreateObject("MSCOMMLib.MSComm")


MSComm1.CommPort = gblCustDisplayCommPort
MSComm1.Settings = "9600,N,8,1"
MSComm1.PortOpen = True
MSComm1.Output = Chr$(27) & "@"
MSComm1.Output = Chr$(13)
MSComm1.Output = Chr$(27) + "U"
MSComm1.Output = ""
MSComm1.Output = Chr$(13)
MSComm1.Output = Chr$(27) + "D"
MSComm1.Output = ""
MSComm1.PortOpen = False



Exit Sub

errhandler:
   
    MsgBox Err.Description, vbCritical, "ERROR In CustDisplayInitialize"
    MsgBox "You will not be able to use the CustomerDisplay until this problem is solved.", vbInformation, ""
    gblCustDisplayCommPort = 0


End Sub
Eamon

ASKER
rockiroads
I have registered it manually and there is no error.
I agree with you that it must be something to do with the registering of the control.
I will take a fresh look at it on Monday.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Surone1


Shell "cmd /c echo " &  Chr$(27) & "@"  &" > " & gblCustDisplayCommPort , vbHide
Shell "cmd /c echo " &  Chr$(13)  &" > " & gblCustDisplayCommPort , vbHide
Eamon

ASKER
Surone1
Thanks but I'd rather sort the issue than try to work around it.
EDDYKT

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Scott McDaniel (EE MVE )

Also, MS has released several Security Bulletins for a LOT of ActiveX controls ... are you certain the machine where you're having troubles is up to date with all Windows/Office Service Packs? I don't see that actual control listed, but it's heavily dependent on other controls, so that may be your issue.
Eamon

ASKER
On one of the computers in the stores I have a vb6 program installed that uses the comm control.
This program is working fine. I don't really understand how the licensing works.
Do I not have a license for the vb6 program running in the store.
Eamon

ASKER
I mentioned previous to this that I have a access form with the control on it and this worked. So how come I have a licence for that.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
EDDYKT

try to download from here

http://activex.microsoft.com/controls/vb6/MScomm32.cab

and put both into system32 and register
SOLUTION
Scott McDaniel (EE MVE )

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Eamon

ASKER
Will try it wednesday. have to leave now. Thanks for the help