Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]MarketData_ReportNotify事件触发的问题

1楼
REYH 发表于:2015/3/3 23:42:36
程序运行结果:D盘指定excel文件"D:\TradeExcel.xlsx"能够打开,单元格A1的值赋为123
         问题是:为什么在MarketData_ReportNotify触发之后,单元格A2没有显示最新价格
         请问是什么原因,请高手指点,谢谢~~
-----------------------------
public ExcelApp 

Sub APPLICATION_VBAStart()
      Call MarketData.RegReportNotify("ZS05","CB")
      Set ExcelApp = GetObject("D:\TradeExcel.xlsx") 
      ExcelApp.Parent.Windows("TradeExcel.xlsx").Activate 
      ExcelApp.Application.Visible = True

      ExcelApp.Application.Workbooks(1).Worksheets(1).Cells(1,1).Value=123
End Sub


Sub MarketData_ReportNotify(ReportData)
    dim NewPrice
    NewPrice = ReportData.NewPrice
    ExcelApp.Application.Workbooks(1).Worksheets(1).Cells(2,1).Value = NewPrice
End Sub
2楼
guotx2010 发表于:2015/3/4 8:17:59

on error resume next
      Set ExcelApp = GetObject(, "Excel.Application") '
      If Err.Number <> 0 Then
        Set ExcelApp = CreateObject("Excel.Application")
    End if

      '将对象变量设为对要看的文件的引用。
      Set ExcelApp = GetObject("D:\TradeExcel.xlsx")

 

代码中打开Excel文件的代码需要做修改,有行情的时候才能测试

3楼
REYH 发表于:2015/3/4 9:09:33
谢谢guotx2010
共3 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.04297 s, 2 queries.