以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  高级功能研发区  (http://www.weistock.com/bbs/list.asp?boardid=5)
----  VBA求助  (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=12354)

--  作者:Leon
--  发布时间:2012/6/11 12:47:24
--  VBA求助

不知道什么原因,总提示语法错误,将前两行的定义 数据类型去掉,仍然报语法错误,希望高手解答啊~

public InpMinihub as Integer
 public hubnum as Integer

 public hubid()
 public hubopen()
 public hubclose()
 public hubbas()
 public hublast()

 private history
 private grd 

Sub Init(gridobj as grid)
 grd=gridobj
 history=grd.getHistoryData()
 InpMiniHub=3
End Sub

Sub getHub()
 hubnum=0
 barpos=0
 do
  barpos=dupHub(barpos)
 loop while barpos<history.count-1

End Sub


Function dupHub(pos as integer)
 dim curopen,curclose,curbas,curlast
 dim wide as integer
 
 curopen=history.High(pos)
 curclose=history.Low(pos)
 curbas=pos
 wide=1
 
 for idx=pos+1 to history.datacount-1
  if (history.high(idx)<curclose or history.low(idx)>curopen) then
   if (wide<InpMiniHub) then
    dupHub=idx
    exit function
   else
    hubopen(hubnum)=curopen
    hubclose(hubnum)=curclose
    hubbas(hubnum)=curbas
    hublast(hubnum)=idx-1
    hubwide(hubnum)=getHubLevel(hublast-hubbas+1)
    hubid(hubnum)="0_"+hubbas(hubnum)+"_"+hublast(hubnum) 
    dupHub=idx
    hubnum++
    exit function
   end if
  else
   wide++
   curopen=(curopen*wide+history.high(idx))/(wide+1)
   curclose=(curclose*wide+history.low(idx))/(wide+1)
  end if
 next
 
End Function


--  作者:王锋
--  发布时间:2012/6/11 14:58:43
--  

你这里根本就不是VBS的语法


--  作者:guotx2010
--  发布时间:2012/6/11 16:05:13
--  

vbs没有数据类型定义的,那些as Integer之类的都需要修改,函数的参数也一样,不要定义数据类型。


--  作者:guotx2010
--  发布时间:2012/6/11 16:06:20
--  

http://www.weistock.com/bbs/dispbbs.asp?boardid=5&Id=10387

看看这个帖子,好好学习一下vbs语法。