我想在Excel 2013上运行此代码。
表单上的按钮运行以下子项:
Sub OpenPort()
With Worksheets("SerialPort").MSComm1
.CommPort = 5
.Settings = "9600,n,8,1"
.RThreshold = 1
.InBufferSize = 4096
.PortOpen = True
End With
End Sub
但是当我运行代码时,会出现此消息:
runtime error "438"
object doesn't support this property or method
我认为我的mscomm32.ocx文件有问题。但我添加并将此文件注册到syswow64文件夹中。问题是我如何在Excel文件中运行MSComm控件?