hello guys, in the sample DDE workbook, historical data will be downloaded onto a new worksheet. I want the data to be downloaded onto the same worksheet. In other word, i wanna manupulate the data download area. Question is How?
I looked at the VBA below but cant find my way.
Sub requestHistoricalData()
Dim server As String, req As String, reqType As String, id As String
server = util.getServerStr(serverCell)
If server = "" Then Exit Sub
If Not util.composeContractReq(ActiveCell, req, reqType, True) Then Exit Sub
id = util.getIDpost(genId)
Dim endDateTime As String, duration As String, barSize As String, whatToShow As String, _
rthOnly As String, dateFormatStyle As String, allowExpired As String
endDateTime = UCase(ActiveCell.offset(0, reqOffset + 1).value)
duration = UCase(ActiveCell.offset(0, reqOffset + 2).value)
barSize = UCase(ActiveCell.offset(0, reqOffset + 3).value)
whatToShow = UCase(ActiveCell.offset(0, reqOffset + 4).value)
rthOnly = UCase(ActiveCell.offset(0, reqOffset + 5).value)
dateFormatStyle = UCase(ActiveCell.offset(0, reqOffset + 6).value)
allowExpired = UCase(ActiveCell.offset(0, reqOffset + 8).value)
If allowExpired <> "" Then
allowExpired = util.UNDERSCORE & allowExpired
End If
If endDateTime = "" Or duration = "" Or barSize = "" Or whatToShow = "" Or rthOnly = "" Or dateFormatStyle = "" Then
MsgBox ("You must enter all of endDateTime, duration type, barSize, whatToShow, rthOnly, and dateFormatStyle.")
Exit Sub
End If
req = req & util.UNDERSCORE & endDateTime & util.UNDERSCORE & duration & util.UNDERSCORE & _
barSize & util.UNDERSCORE & whatToShow & util.UNDERSCORE & rthOnly & util.UNDERSCORE & _
dateFormatStyle & allowExpired
Cells(ActiveCell.row, controlCol).Formula = util.composeControlLink(server, topic, id, reqType, req)
ActiveCell.offset(1, 0).Activate ' move cursor down
End Sub
Function composeControlLink(server, topic, id, reqType, rawReq) As String
composeControlLink = composeLink(server, topic, TICK_CHAR & id, reqType & QMARK & rawReq & TICK_CHAR)
End Function
I looked at the VBA below but cant find my way.
Sub requestHistoricalData()
Dim server As String, req As String, reqType As String, id As String
server = util.getServerStr(serverCell)
If server = "" Then Exit Sub
If Not util.composeContractReq(ActiveCell, req, reqType, True) Then Exit Sub
id = util.getIDpost(genId)
Dim endDateTime As String, duration As String, barSize As String, whatToShow As String, _
rthOnly As String, dateFormatStyle As String, allowExpired As String
endDateTime = UCase(ActiveCell.offset(0, reqOffset + 1).value)
duration = UCase(ActiveCell.offset(0, reqOffset + 2).value)
barSize = UCase(ActiveCell.offset(0, reqOffset + 3).value)
whatToShow = UCase(ActiveCell.offset(0, reqOffset + 4).value)
rthOnly = UCase(ActiveCell.offset(0, reqOffset + 5).value)
dateFormatStyle = UCase(ActiveCell.offset(0, reqOffset + 6).value)
allowExpired = UCase(ActiveCell.offset(0, reqOffset + 8).value)
If allowExpired <> "" Then
allowExpired = util.UNDERSCORE & allowExpired
End If
If endDateTime = "" Or duration = "" Or barSize = "" Or whatToShow = "" Or rthOnly = "" Or dateFormatStyle = "" Then
MsgBox ("You must enter all of endDateTime, duration type, barSize, whatToShow, rthOnly, and dateFormatStyle.")
Exit Sub
End If
req = req & util.UNDERSCORE & endDateTime & util.UNDERSCORE & duration & util.UNDERSCORE & _
barSize & util.UNDERSCORE & whatToShow & util.UNDERSCORE & rthOnly & util.UNDERSCORE & _
dateFormatStyle & allowExpired
Cells(ActiveCell.row, controlCol).Formula = util.composeControlLink(server, topic, id, reqType, req)
ActiveCell.offset(1, 0).Activate ' move cursor down
End Sub
Function composeControlLink(server, topic, id, reqType, rawReq) As String
composeControlLink = composeLink(server, topic, TICK_CHAR & id, reqType & QMARK & rawReq & TICK_CHAR)
End Function