Hi everyone,
I have been stumped on a small project (well I though it would be small) that would use an excel front end (using a form) and VBA to read the temperature and humidity of a ethernet connected temperature gauge and display the results on the form.
I have been trying to use "Ostrosoft" and "Winsock", but my code will not create the object. The code fails at the "Set wsTCP" step. Sample of code is below.
I have the "Ostrosoft Winsock Component" is enabled in the references and the "OSWINSCK.dll" registered.
The errorhandler just says it "Error 429: ActiveX component can't create object"
I get the same error whether using oswinsck or winsock.
I feel that I am missing something fundamental to get this to work.
A fee additional details:
I am using WIN7Professional 64 bit, Microsoft Office Professional Plus 2013.
Any ideas?
Thank You,
John
A sample part of my code is:
Option Explicit
Dim bytesTotal As Long
Dim sPage As String
Dim MbusQuery
Dim returnInfo
Dim wsTCPgdb
Dim WithEvents wsTCP As OSWINSCK.Winsock
Dim SetObject
Dim RetrieveData
Private Sub CommandButton1_Click() ' Retrieve Data
On Error GoTo ErrHandler
Dim sServer As String
Dim nPort As Long
Dim StartTime
DoEvents
nPort = 502 ' See configuration in Do-More Designer
' Set the IP address of the PLC
sServer = Sheets("Sheet1").Range("B4") ' ”192.168.1.3”
RetrieveData = 1
CommandButton1.BackColor = "&H0000FF00" 'Set colour to Green
'Check to see if the object has been created. If not set wsTCP.
If SetObject = "" Then
Set wsTCP = CreateObject("OSWINSCK.Winsock")
I have been stumped on a small project (well I though it would be small) that would use an excel front end (using a form) and VBA to read the temperature and humidity of a ethernet connected temperature gauge and display the results on the form.
I have been trying to use "Ostrosoft" and "Winsock", but my code will not create the object. The code fails at the "Set wsTCP" step. Sample of code is below.
I have the "Ostrosoft Winsock Component" is enabled in the references and the "OSWINSCK.dll" registered.
The errorhandler just says it "Error 429: ActiveX component can't create object"
I get the same error whether using oswinsck or winsock.
I feel that I am missing something fundamental to get this to work.
A fee additional details:
I am using WIN7Professional 64 bit, Microsoft Office Professional Plus 2013.
Any ideas?
Thank You,
John
A sample part of my code is:
Option Explicit
Dim bytesTotal As Long
Dim sPage As String
Dim MbusQuery
Dim returnInfo
Dim wsTCPgdb
Dim WithEvents wsTCP As OSWINSCK.Winsock
Dim SetObject
Dim RetrieveData
Private Sub CommandButton1_Click() ' Retrieve Data
On Error GoTo ErrHandler
Dim sServer As String
Dim nPort As Long
Dim StartTime
DoEvents
nPort = 502 ' See configuration in Do-More Designer
' Set the IP address of the PLC
sServer = Sheets("Sheet1").Range("B4") ' ”192.168.1.3”
RetrieveData = 1
CommandButton1.BackColor = "&H0000FF00" 'Set colour to Green
'Check to see if the object has been created. If not set wsTCP.
If SetObject = "" Then
Set wsTCP = CreateObject("OSWINSCK.Winsock")