在以下代码中,for循环内通过Application.SendMessage(57602)或者Application.PostMessage(57602)来关闭当前框架时,经常未能成功,特别是操作多个框架时,请问是什么问题?为了避免失去鼠标焦点问题,我还特意在循环里面加了ShowWindow和ActivateFrame来保证选中金字塔主程序和当前框架,但是依然无果。如果把Application.SendMessage(57602)放在循环之外,即先打开所有框架处理完后,再逐个关闭框架,则可正常关闭所有框架,但是这样势必会增加资源占用,导致金字塔崩溃。我现在想要做的操作就是,逐一打开各个框架,打开一个框架后处理完马上关掉这个框架,再打开下一个框架处理完再马上关掉。。。
[此贴子已经被作者于2017/3/28 16:35:10编辑过]
set list = CreateObject("System.Collections.ArrayList")
frameArray = Array("f1", "f2", "f3")
frameNum = UBound(frameArray) + 1
for i = 0 to frameNum - 1
set frame = Application.ActivateFrame(frameArray(i))
gridNum = frame.GridCount
for j = 0 to gridNum - 1
set grid = frame.GetGridByIndex(j)
if grid.FormulaCount = 2 then
set formula = grid.GetFormulaByIndex(1)
a = formula.GetBufData("info", formula.DataSize-1)
list.Add a
end if
next
Application.ShowWindow(3)
Application.ActivateFrame(frameArray(i))
Application.SendMessage(57602)
next
list.Clear
set list = nothing
set frame = nothing
set grid = nothing
set formula = nothing
.
[此贴子已经被作者于2017/3/28 16:43:36编辑过]
set list = CreateObject("System.Collections.ArrayList")
frameArray = Array("f1", "f2", "f3")
frameNum = UBound(frameArray) + 1
for i = 0 to frameNum - 1
set frame = Application.ActivateFrame(frameArray(i))
gridNum = frame.GridCount
for j = 0 to gridNum - 1
set grid = frame.GetGridByIndex(j)
if grid.FormulaCount = 2 then
set formula = grid.GetFormulaByIndex(1)
a = formula.GetBufData("info", formula.DataSize-1)
list.Add a
end if
next
Application.ShowWindow(3)
Application.ActivateFrame(frameArray(i))
Application.SendMessage(57602)
next
list.Clear
set list = nothing
set frame = nothing
set grid = nothing
set formula = nothing
以上是代码。我去,这是什么破代码编辑器如此反人类,还不能缩进。。。
后面版本我们计划增加关闭框架的函数,请耐心等待一下