各位,我有一个word文档,原来没有什么特殊的,但是我想把它saveas成ReadOnlyRecommended的属性为true。我只想把这个文档saveas成原来的那个文档,并不想创建一个新的文档,但是却没有成功,请问是为什么,该怎么解决,请给位帮我看一下源代码:我的word版本是2000On Error Resume Next    Set oWord = CreateObject("Word.Application")
    If Err.Number <> 0 Then
        sMsg = "Unable to create Word.Application object " & Err.Description
    End If
    
    oWord.Visible = True
    
        Set oDocument = oWord.Documents.Open(FileName:="c:\1.doc")
   
   
    If Err.Number <> 0 Then
        sMsg = "Unable to load Word document " & Err.Description
    End If
    
    oDocument.saveas FileName:="c:\11.doc", ReadOnlyRecommended:=True
    If Err.Number <> 0 Then
        sMsg = "Unable to create Word.Application object " & Err.Description
    End If
    oDocument.Close

解决方案 »

  1.   

    不好意思,上面这个是可以成功的,但saveas自己的代码就不成功,也没有报错On Error Resume Next    Set oWord = CreateObject("Word.Application")
        If Err.Number <> 0 Then
            sMsg = "Unable to create Word.Application object " & Err.Description
        End If
        
        oWord.Visible = True
        
            Set oDocument = oWord.Documents.Open(FileName:="c:\1.doc")
       
       
        If Err.Number <> 0 Then
            sMsg = "Unable to load Word document " & Err.Description
        End If
        
        oDocument.saveas FileName:="c:\1.doc", ReadOnlyRecommended:=True
        If Err.Number <> 0 Then
            sMsg = "Unable to create Word.Application object " & Err.Description
        End If
        oDocument.Close
      

  2.   

    http://www.edacn.net/bbs/get.php?id=23516
      

  3.   

    可以这样:
    oDocument.saveas FileName:="c:\1.doc", ReadOnlyRecommended:=True
    ----------------------------------------
    上面的改为下面的两句:
    oDocument.ReadOnlyRecommended = True
    oDocument.Save