我用这样的方法:
Dim xmlFilePath As String
Dim PicPath As String
xmlFilePath = "C:\Recog.xml"
PicPath = "C:\\PicGet.jpg"
Dim ret As Long
o.GetScan(xmlFilePath, PicPath) = ret但是是错的

解决方案 »

  1.   

    dim mobj as object
    set mobj=createobject("com组件名")
    ret=mobj.GetScan(xmlFilePath,PicPath)
      

  2.   

    no. 
    我用
    Dim o as EX23b   '(ex23b是COM对象)
    set o = new EX23b
    Dim xmlFilePath As String
    Dim PicPath As String
    xmlFilePath = "C:\Recog.xml"
    PicPath = "C:\\PicGet.jpg"
    Dim ret As Long
    ret = o.GetScan(xmlFilePath, PicPath) 但是Compile “o.GetScan(xmlFilePath, PicPath) = ret
    ”时,就出错!
      

  3.   

    你这种调用方式要先对它引用
    Project->Reference->Browse
      

  4.   

    是,我也引用了。
    我的完整的code :
    Dim o As EX23b.GetScan
    Set o = New EX23b.GetScanDim bstrFile As String, bstrPic As String
    bstrFile = "c:\rec.xml"
    bstrPic = "c:\pic.jpg"
    Dim result As Long
    result = o.GetScan(bstrFile, bstrPic)Set o = Nothing
    但是但是Compile “o.GetScan(xmlFilePath, PicPath) = ret 出错!
    GetScan(BSTR,BSTR)我是用VC写的。
    但是在VB中,不知为什么好象变为GetScan(xmlFilePath as string, PicPath as string)
    我觉得是这个问题!他的错误是

    Compile Error:
    Expected Function or Variable