我用了docTemp.BuiltInDocumentProperties.Item(15).Value方法获得了工具-〉字数统计中其他统计数,可是就是得不到-〉“中文字符和朝鲜语单词”。用那个函数才能得到这个统计数呢?
可能调用别的对象以及函数吧。
vba接触才几天,请多多关照。
谢谢各位高手。

解决方案 »

  1.   

    ComputeStatistics方法,详细使用清参照Office帮助文件VBAWRD9.CHM。
      

  2.   

    哇,你太棒了,thank you very much.现在就试试。
      

  3.   

    顺便问一下,我想指定一个目录,然后用for循环得到目录下的文件,我写成这个样子。
    Private Sub opendoc()    Dim docTemp As Document
        Dim subdoc As Document
        
        'Set docTemp = Application.Documents("E:\my_job\absent\diary\")
        ChangeFileOpenDirectory "E:\my_job\absent\diary"    For Each subdoc In ActiveDocument.Subdocuments
        If subdoc.HasFile = True Then
            Debug.Print subdoc.Path & Application.PathSeparator _
                & subdoc.Name
        Else
            Debug.Print "このサブ文書は保存されていません。"
        End If
        Next subdoc
        
        'Call getCount(docTemp)
        docTemp.Close
    End Sub
    请高手指点。
      

  4.   

    不知dir()怎么用?
    我是这么写的。
    ChDir "E:\my_job\absent\diary"
        myName = Dir("*.doc")
        
        While myName <> ""
            myName = Dir()
        Wend
    请各位高手不吝赐教。谢谢。
      

  5.   

    抄个例子:
    Dir Function Example
    This example uses the Dir function to check if certain files and directories exist. Dim MyFile, MyPath, MyName
    ' Returns "WIN.INI"  if it exists.
    MyFile = Dir("C:\WINDOWS\WIN.INI")   ' Returns filename with specified extension. If more than one *.ini
    ' file exists, the first file found is returned.
    MyFile = Dir("C:\WINDOWS\*.INI")' Call Dir again without arguments to return the next *.INI file in the 
    ' same directory.
    MyFile = Dir' Return first *.TXT file with a set hidden attribute.
    MyFile = Dir("*.TXT", vbHidden)' Display the names in C:\ that represent directories.
    MyPath = "c:\"   ' Set the path.
    MyName = Dir(MyPath, vbDirectory)   ' Retrieve the first entry.
    Do While MyName <> ""   ' Start the loop.
       ' Ignore the current directory and the encompassing directory.
       If MyName <> "." And MyName <> ".." Then
          ' Use bitwise comparison to make sure MyName is a directory.
          If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
             Debug.Print MyName   ' Display entry only if it
          End If   ' it represents a directory.
       End If
       MyName = Dir   ' Get next entry.
    Loop
      

  6.   

    两位高手谢谢你们,I got it.现在只剩一个问题了。就是往新的exel文件输入进去。呵呵,太开心了,老板急得很。