Hi all, i have the below example of code that detects when BACK_COM is in cell T5 of Sheet1. When ba.placeBet is initiated, the program "Betting Assistant" will automatically call ba_betPlaced.
What i am looking to do is rather than have the initial ba.placeBet triggered on Workseet_Change, i would like to run it myself as a Macro. This i have done, however, when this now runs as a macro in a module, it will not trigger the ba_betPlaced routine on Sheet1. I have tried setting it to Public with no success.
Any ideas please?
Many thanks
Original Code:
Where i am at the moment:
Sheet1:
Module1:
What i am looking to do is rather than have the initial ba.placeBet triggered on Workseet_Change, i would like to run it myself as a Macro. This i have done, however, when this now runs as a macro in a module, it will not trigger the ba_betPlaced routine on Sheet1. I have tried setting it to Public with no success.
Any ideas please?
Many thanks
Original Code:
Code:
Dim WithEvents ba As BettingAssistantCom.ComClass
Private Sub ba_betPlaced(ByVal ref As String, ByVal avgPriceMatched As Double, ByVal sizeMatched As Double)
[T5] = ref
[V5] = avgPriceMatched
[W5] = sizeMatched
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If [Q5] = "BACK_COM" And [T5] = "" Then
ba.placeBet 0, "B", [R5], [S5], False, ""
End If
End Sub
Where i am at the moment:
Sheet1:
Code:
Dim WithEvents ba As BettingAssistantCom.ComClass
Public Sub ba_betPlaced(ByVal ref As String, ByVal avgPriceMatched As Double, ByVal sizeMatched As Double)
[T5] = ref
[V5] = avgPriceMatched
[W5] = sizeMatched
End Sub
Module1:
Code:
Dim ba As New BettingAssistantCom.ComClassPublic
Sub Test()
If ba Is Nothing Then
Set ba = New BettingAssistantCom.ComClass
End If
ba.placeBet 0, "B", "100", "2", False, ""
End Sub
Last edited: