Visual Basic for Applications Serial Port Software Example For this demonstration we will be using the mscomm32.ocx driver in VBA to control a RS232 serial port and USB virtual serial port that is created with the USB driver installed on your system for our USB products. This allows a seamless transition between our and devices. For example, you can be in Access, Excel, or Word and start a macro that would power up an external data acquisition unit and receive data into the software utilizing VBA, serial control, and one of our. You could control room lighting, or any other device that you would like to turn ON or OFF from within an application, just think of the many possibilities.

I need to send commands to an external device using a serial port. Found this: http://dev.emcelettronica.com/serial-port.ation-excel-VBA. How can I read a serial (COMM) port from Excel Visual Basic? MSComm32.OCX will not register in this version of XL2007. MSComm32.OCX will not register in this version of XL2007. I have used MSComm in Excel successfully with XL2007 on an XP computer before.

Visual Basic for Applications has many of Visual Basic's commands and controls, that can be utilized for control applications. We will show you how to use this powerful application to control our serial relay boards.

Note: this example is tailored to the first time Visual Basic for Applications user, but the information is useful for the advanced user that is unfamiliar with serial port control. If you're familiar with VBA and want to skip this demo, you may jump directly to the. Free download norton ghost 2003 iso.

Let's get started: For this demonstration we will use Excel's VBA editor, but any of the software that has built in VBA support will work. Start Excel and select >> Tools >> Macro >> Visual Basic Editor, from the pull down menus as shown in the picture below, or use Alt+F11 shortcut. Depending on which version of Excel you are using, this and the following screen may look different.

The Visual Basic Editor will appear as shown below. After VBA is loaded, Right Click in the project window, Select >> Insert >> Userform and a blank form will be loaded, with a control tool box as shown below.

Excel Vba Serial Port Mscomm32

Now we are going to add a serial port control to the control box so that we may use it in our application. For this demonstration we are going to use the mscomm32.ocx communication driver, depending on what other MS applications you have loaded on your system, this driver may or may not be available on your system. Right click in the controls box and select >> Additional Controls Scroll down to you see Microsoft Communications Control, and click on the check box on the left, as shown below. If you don't see this driver available in the additional controls window you can do a file search using windows Start >> Find >> File or Folder to search for mscomm32.ocx. If this file is found you need to copy this file into the c: windows system directory so the VBA can find it.

Popular Posts