The project name is "SaveWord" and the module name is "Toword".There is a function named "UpdateWord" in this module.But when I write the code:   set ttt = createobject(saveword.I want to see the function name, but nothing occured. It said"未找到方法或数据成员"What's the matter?? Help me...
The module function is as following:
===========================Public Function UpdateWord(strarr() As Byte) As IntegerDim Wobj As Word.Application
Dim wordDoc As Word.DocumentSet Wobj = CreateObject("Word.Application")Set wordDoc = Wobj.Documents.Open("c:\subject.doc")Wobj.Application.Visible = False
                    
Wobj.Selection.Find.ClearFormatting
Wobj.Selection.Find.Replacement.ClearFormatting
For i = 1 To 10
    If IsNull(strarr(i, 1)) = False And strarr(i, 1) <> "" Then
    
        strRep = strarr(i, 2)       With Wobj.Selection.Find
            .Text = strarr(1, 1)
            .Replacement.Text = strRep
            .Forward = True
            .MatchByte = True
       End With
                        
       Wobj.Selection.Find.Execute Replace:=wdReplaceAll    
    End If
    
Next i
                            
  wordDoc.Save
  wordDoc.Close
                        
                        
Set wordDoc = Nothing
Set Wobj = Nothingtoword = 1End Function

解决方案 »

  1.   

    CreateObject("类.成员"),注意,要加双引号的
    不过老实说,你的Help Me之前的一段话,我不明白你的意思。
    你的SaveWord工程是和主工程在一个工程组里面的吗?
      

  2.   

    The module you wrote is a private module (only visible to the classes/modules in the project 'SaveWord'), but not the "outsiders".
    You should put the code in a standard, public class in order to be able to create an instance of it and invoke its methods.
    Just remember, modules are ALWAYS private.
    And, it's recommended to use compile-time-binding (namely, Project->Reference menu setting), rather than run-time-binding (namely, CreateObject, etc.)
      

  3.   

    》pigpagCreateObject时点不开来,不象点其它的东东时点的开来。》James0001
    那我怎么使module成为public呢?怎么解决"未找到方法或数据成员"这一问题?谁肯把我的代码试验一下呢?
      

  4.   

    用createobject定义对象是动态绑定的,所以该对象的属性和方法;
    你可以在工程-》引用菜单中引用你的组件,然后声明的对象就可以了。
      

  5.   

    用createobject定义对象是动态绑定的,所以该对象的属性和方法看不到;你可以在工程-》引用菜单中引用你的组件,然后声明的对象就可以看到了。
      

  6.   

    我知道了,你必须把Module改成Class.
    Module是不会提供类接口的。SaveWord里面没有任何接口可供外部使用。
      

  7.   

    how to? The class is ModuleClass.>你必须把Module改成Class.
      

  8.   

    实时错误‘91’
    对象变量或WITH块变量未设置?
    ===========Private Sub Form_Load()
    'Dim tt As Saveword.towordDim aa(2, 2) As String
    Dim i As Integer
    aa(1, 1) = "Subject"
    aa(1, 2) = "menu"Dim tt As towordi = tt.UpdateWord(aa)
    End Sub