以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  高级功能研发区  (http://weistock.com/bbs/list.asp?boardid=5)
----  vba中引用另一个自定义函数,请问应该是什么格式?  (http://weistock.com/bbs/dispbbs.asp?boardid=5&id=73370)

--  作者:qq代人发帖
--  发布时间:2014/12/22 10:27:55
--  vba中引用另一个自定义函数,请问应该是什么格式?
请教:vba中引用另一个自定义函数,请问应该是什么格式?
由于在perl中自定义的函数,其参数自带Formula 对象,是不是需要有个Formula参数?这个自定义函数是公式编辑器中新建的。

--  作者:dwjgwsm
--  发布时间:2014/12/22 11:35:09
--  
需要指定一个Formula对象,我用的下面的方法获得,比较繁琐,不知道有别的简单的办法么?
Sub TEST()

N=Technic.GridCount
for i=0 to N-1
  set Grid=Technic.GetGridByIndex(i)
  Label=Grid.StockLabel
  M=Grid.FormulaCount             
  TP=Grid.TYPE
  if Label="M05" and TP=1 and M>0 and instr(Grid.name,"Window")>0 then  \'根据副图的几个特点定位副图
     set Formula=Grid.GetFormulaByName("BBB")
     BOTP Formula,参数1,参数2
     set Grid=nothing
     set Formula=nothing
     exit sub
  END IF
next

End Sub