Comm32 Logo
Home Button   

Topic:   deployment

By: JeremyPosted on: May 31 2011 at 06:27:23 PM
I have an Excel VBA app that I wrote using MScomm32, but when I put the Excel file on another computer without VB6, the comm object is no longer on the worksheet. The ocx is properly registered with Windows.

1. Will I have this problem with Comm32?

2. Is Comm32 as fast as MSComm32?

I've used a similar program call ActiveComPort, but it's really slow compared to MSComm32.

Thanks.

By: GuestPosted on: Jun 1 2011 at 12:00:09 AM
The reason mscomm32 won't work on excel sheets on other computers is that excel always loads an OCX in developer mode so needs a developer license.


I think you'll have the same problem with the Comm32 OCX. It needs a developer license to use the OCX in a development environment and because excel is always in dev mode it'll keep asking for the license key

By: JeremyPosted on: Jun 1 2011 at 02:04:44 AM
So how would I distribute my Excel app with Comm32?

ActiveComPort solves the problem by allowing you to activate the license in your code.

example:

objComport.Activate "0F3EF-4F9X2-8D974"

By: GuestPosted on: Jun 1 2011 at 06:57:12 PM
The way I do it is to put the vb code in a separate Visual Basic form that you compile as an EXE. The OCX is on that form so no longer sees the excel IDE. The executable can still read and write to the excel sheet.

An advantage of this approach is that your excel users don't fiddle with the vb code and you can send users updated software without sending the excel sheet again. Or send an updated excel sheet without needing to send the vb again.

You'll also be able to use MSComm ;o)

By: GuestPosted on: Jun 1 2011 at 09:32:03 PM
Do I have to use DDE to make Excel and VB exe talk to each other?

By: Guest Posted on: Jun 1 2011 at 11:43:16 PM
In vb6 you can use the data control. That can connect to access, fox pro and excel. Personally I prefer DAO. In references set a reference to dao360 and then I can talk to the excel file almost as of it was a database file using SQL syntax.

If you've never done anything like that then it can be a bit of a learning curve although it is quite simple.

If you want to manipulate whole worksheets, charts and formulas etc then you can do it using OLE basically opening an excel namespace in code. When I do that I'm not always sure of the excel syntax so I use excel to record macros which I then copy and paste into the vb form. Basically a lot of the vba code you already have will work with hardly any changes in a vb application once you get the hang of implementing the excel workspace in a vb form.

There's lots of ways to do it. Google is your friend. Once you start coding outside of the excel file you get tons of flexibility so certainly worth taking the time to explore it in more detail.

By: GuestPosted on: Jun 2 2011 at 05:56:51 PM
If I create a standalone .exe (or .dll?) in VB for the serial comm stuff, how do I call those routines from Excel?
Thanks.

By: GuestPosted on: Jun 2 2011 at 06:55:34 PM
If you want to add an exe to your project then consider way to get all of your vba code running in the exe instead of in the excel file.

By: TomPosted on: Jun 2 2011 at 07:28:11 PM
I've done projects using mscomm32 and excel.

I have all the code that manipulates the sheets as vba in the excel. But the data collection is in an external exe. As the exe collects the data from the rs232 port it puts it into a column in the excel file and then vba code in the excel file reads it out of that column and processes it further.

As the previous guy said, once you get the exe file in your project it opens up a lot of flexibility, not least the ability to use MSComm or any other com component.