Does any expert can help me to modify this file which is created by my friend before , I want to modify the "Trade" Button to auto run , if range F3:I3 is blank - no action, if range F3:I3 has figure - "Trade" Button will auto run itself. Here is the VBA
text1.pngtext2.png
Public channelno As Long
Public cmdstr As String
Public cmdID As Integer
Public DELIMITER As String
Public cur_index As Integer
Private Sub CommandButton1_Click()
Dim tmpstr As String
channelno = DDEInitiate("xx.xx", "Trade")
cur_index = 3
cmdID = 0
DELIMITER = "~:~"
cmdstr = Trim(Str(cmdID)) & DELIMITER & "LOGIN" & DELIMITER & "ID=12345678" & DELIMITER & "CH=ABCD"
tmpstr = "M" & Format(cur_index)
Range(tmpstr) = cmdstr
cur_index = cur_index + 1
cmdID = cmdID + 1
DDEPoke channelno, "command", Range(tmpstr)
End Sub
Private Sub CommandButton2_Click()
Dim myvar As Variant
Dim restr As String
cmdstr = Trim(Str(cmdID)) & DELIMITER & "TRADELFUTURES" & DELIMITER & "Accode=12345678" & DELIMITER & "Code=" & Range("F3").Text & DELIMITER & "Side=" & Range("I3").Text & DELIMITER & "Qty=" & Range("H3").Text & DELIMITER & "Price=" & Range("g3").Text
tmpstr = "M" & Format(cur_index)
Range(tmpstr) = cmdstr
cur_index = cur_index + 1
cmdID = cmdID + 1
DDEPoke channelno, "command", Range(tmpstr)
End Sub
Private Sub CommandButton4_Click()
DDETerminate (channelno)
End Sub
Bookmarks