以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 高级功能研发区 (http://www.weistock.com/bbs/list.asp?boardid=5) ---- [求助]请问金字塔怎么同时开启来多Excel文件这么这样行不通 (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=79437) |
-- 作者:cyq220657 -- 发布时间:2015/6/5 15:48:46 -- [求助]请问金字塔怎么同时开启来多Excel文件这么这样行不通 这样只有开启一个Excel文件,求解决 开起多个Excel文件方法 PUBLIC ExcelApp,NowWrite(20),ExcelApp1 Sub StartExcel() OpenExcelFile
OpenExcelFile2 End sub Sub OpenExcelFile()
On Error Resume Next
Set ExcelApp = GetObject(,"Excel.Application")
if Err.number<>0 then
Set ExcelApp = CreateObject("Excel.Application")
\'打开指定文件
Set ExcelApp = GetObject("d:\\金字塔决策交易系统\\orderlog\\TradeLog.xls")
\'打开指定文件
Set ExcelApp = ExcelApp.Workbooks("TradeLog.xls")
If Err.number<>0 then
Set ExcelApp = GetObject("d:\\金字塔决策交易系统\\orderlog\\TradeLog.xls")
End If
end if
ExcelApp.Parent.Windows("TradeLog.xls").Activate
ExcelApp.Application.DisplayFormulaBar=False
If ExcelApp.Application.Visible = False then
ExcelApp.Application.Visible = True
End if
ExcelApp.Application.DisplayAlerts=False end sub Sub OpenExcelFile2()
On Error Resume Next
Set ExcelApp1 = GetObject(,"Excel.Application")
if Err.number<>0 then
Set ExcelApp1 = CreateObject("Excel.Application")
\'打开指定文件
Set ExcelApp1 = GetObject("d:\\金字塔决策交易系统\\orderlog\\VirtualTradeLog.xls")
\'打开指定文件
Set ExcelApp1 = ExcelApp1.Workbooks("VirtualTradeLog.xls")
If Err.number<>0 then
Set ExcelApp1 = GetObject("d:\\金字塔决策交易系统\\orderlog\\VirtualTradeLog.xls")
End If
end if
ExcelApp1.Parent.Windows("VirtualTradeLog.xls").Activate
ExcelApp1.Application.DisplayFormulaBar=False
If ExcelApp1.Application.Visible = False then
ExcelApp1.Application.Visible = True
End if
ExcelApp1.Application.DisplayAlerts=False end sub |