Excel Vba Serial Port Mscomm32

Excel Vba Serial Port Mscomm32

Tim, It is very important to know what specific version of the MScomm32.ocx is being used. The available version I knew of that worked was 'killbit'd' a few years back by Microsoft. The MScomm32.ocx is also a licensed control requiring either the full install of Visual Basic (not.Net I think - more research may be required) or a purchased license registry key in order to work.

PortExcel.com port vba

After conducting some basic research on the MScomm32.ocx control, I'm sure by now you've found it has been deprecated. When MS forwarded the specific killbit patch that killed that control, we had five machines that depended on lab chemistry entry based on that control as it connected PC's to chem lab measuring equipment to auto-transfer measurement results of several machines into our Access db. It was only out of my extreme wariness and caution that I caught the killbit patch before it wiped out all our machines. It did kill one machine, (which is how I learned of the killbit patch), and then spent two days rebuilding that machine to regain it's lab functions - being very careful to NOT allow that killbit patch to be installed. And unfortunately, just copying and pasting the MScomm32.ocx file onto a machine will not work - it must also be registered. There was a lot of hub-bub over the unannounced killbit by MS, and the community scrambled to find a suitable replacement. I didn't pursue the dialog as I just 'ducked & covered' and protected my machines from that killbit patch.

Perhaps with some luck you will be able to find a suitable replacement. Hope this helps.

I have a spreadsheet I originally created in Excel 2003 which used the MSCOMM control to read data sent to the serial port. When I upgraded to Excel 2007 this s Excel and MSCOMM control - VBA Visual Basic for Applications (Microsoft) - Tek-Tips.

Public Function CommWrite(intPortID As Integer, strData As String) As Long Dim i As Integer Dim lngStatus As Long, lngSize As Long Dim lngWrSize As Long, lngWrStatus As Long On Error GoTo Routine_Error ' Get the length of the data. LngSize = Len(strData) ' Output the data.

LngWrStatus = WriteFile(udtPorts(intPortID).lngHandle, strData, lngSize, _ lngWrSize, udtCommOverlap) ' Note that normally the following code will not execute because the driver ' caches write operations. Small I/O requests (up to several thousand bytes) ' will normally be accepted immediately and WriteFile will return true even ' though an overlapped operation was specified. DoEvents If lngWrStatus = 0 Then lngStatus = GetLastError If lngStatus = 0 Then GoTo Routine_Exit ElseIf lngStatus = ERROR_IO_PENDING Then ' We should wait for the completion of the write operation so we know ' if it worked or not. ' ' This is only one way to do this. It might be beneficial to place the ' writing operation in a separate thread so that blocking on completion ' will not negatively affect the responsiveness of the UI. ' ' If the write takes long enough to complete, this function will timeout ' according to the CommTimeOuts.WriteTotalTimeoutConstant variable. ' At that time we can check for errors and then wait some more.

' Loop until operation is complete. While GetOverlappedResult(udtPorts(intPortID).lngHandle, _ udtCommOverlap, lngWrSize, True) = 0 lngStatus = GetLastError [b]If lngStatus ERROR_IO_INCOMPLETE Then[/b] lngStatus = SetCommErrorEx( _ 'CommWrite (GetOverlappedResult)', _ udtPorts(intPortID).lngHandle) GoTo Routine_Exit End If Wend Else ' Some other error occurred. Usb microscope uk. LngWrSize = -1 lngStatus = SetCommErrorEx('CommWrite (WriteFile)', _ udtPorts(intPortID).lngHandle) GoTo Routine_Exit End If End If For i = 1 To 10 DoEvents Next Routine_Exit: CommWrite = lngWrSize Exit Function Routine_Error: lngStatus = Err.Number With udtCommError.lngErrorCode = lngStatus.strFunction = 'CommWrite'.strErrorMessage = Err.Description End With Resume Routine_Exit End Function I think that If lngStatus ERROR_IO_INCOMPLETE Then should read If lngStatus = ERROR_IO_INCOMPLETE Then But I need to know for sure because the same syntax error occurs in another function. Although the device I am trying to send a command to has a serial interface, I am using a Serial to USB convertor.

Excel Vba Serial Port Mscomm32
© 2019