如何插入iFIX动态数据到Excel工作.docVIP

  • 6
  • 0
  • 约1.08万字
  • 约 10页
  • 2018-03-09 发布于河南
  • 举报
如何插入iFIX动态数据到Excel工作

写IFIX实时数据到Excel 2007-02-28 11:22 Description Inserting?FIX?Dynamics?data?into?an?Excel?worksheet. Resolution? The?following?procedure?will?enable?you?to?insert?FIX?Dynamics?data?into?an?Excel?worksheet: //?Declare?necessary?API?routines: Private?Declare?Function?FindWindow?Lib?user32?Alias?_ FindWindowA?(ByVal?lpClassName?As?String,?_ ByVal?lpWindowName?As?Long)?As?Long Private?Declare?Function?SendMessage?Lib?user32?Alias?_ SendMessageA?(ByVal?hwnd?As?Long,?_ ByVal?wMsg?As?Long,?_ ByVal?wParam?As?Long,?_ lParam?As?Any)?As?Long Sub?DetectExcel() //?Procedure?dectects?a?running?Excel?and?registers?it. Const?WM_USER?=?1024 Dim?hwnd?As?Long //?If?Excel?is?running?this?API?call?returns?its?handle. hwnd?=?FindWindow(XLMAIN,?0) If?hwnd?=?0?Then?//?0?means?Excel?not?running. Exit?Sub Else //?Excel?is?running?so?use?the?SendMessage?API //?function?to?enter?it?in?the?Running?Object?Table. SendMessage?hwnd,?WM_USER?+?18,?0,?0 End?If End?Sub Private?Sub?CommandButton2_Click() Dim?msexcel?As?Excel.Application Set?msexcel?=?CreateObject(Excel.Application) With?msexcel .Visible?=?True .Workbooks.Open?d:fix32Test1.xls,?,?False End?With End?Sub Private?Sub?CommandButton3_Click() Dim?MyXL?As?Object?//?Variable?to?hold?reference?to?Microsoft?Excel. Dim?ExcelWasNotRunning?As?Boolean?//?Flag?for?final?release. //?Test?to?see?if?there?is?a?copy?of?Microsoft?Excel?already?running. On?Error?Resume?Next?//?Defer?error?trapping. //?Getobject?function?called?without?the?first?argument?returns?a //?reference?to?an?instance?of?the?application.?If?the?application?isn//t //?running,?an?error?occurs.?Note?the?comma?used?as?the?first?argument //?placeholder. Set?MyXL?=?GetObject(,?Excel.Application) If?Err.Number??0?Then?ExcelWasNotRunning?=?True Err.Clear?//?Clear?Err?object?in?case?error?occurred. //?Check?for?Excel.?If?Excel?is?running, //?enter?it?into?the?Running?Object?table. DetectExcel //Set?the?object?variable?to?reference?the?file?you?want?to?see. Set?MyXL?=?GetObject(d:fix32?est1.XLS) /

文档评论(0)

1亿VIP精品文档

相关文档