我用VC++能实现word的打开和关闭,但是翻译不了word宏的文字替换代码
请教高手这样把这段代码翻译成vc++语句 谢谢

解决方案 »

  1.   

    代码如下:
    Selection.Find.ClearFormatting
        Selection.Find.Replacement.ClearFormatting
        With Selection.Find
            .Text = "阿苏大发苏大发"
            .Replacement.Text = "{m_stuio}"
            .Forward = True
            .Wrap = wdFindAsk
            .Format = False
            .MatchCase = False
            .MatchWholeWord = False
            .MatchByte = True
            .CorrectHangulEndings = False
            .MatchAllWordForms = False
            .MatchSoundsLike = False
            .MatchWildcards = False
            .MatchFuzzy = False
        End With
        With Selection
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseStart
            Else
                .Collapse Direction:=wdCollapseEnd
            End If
            .Find.Execute Replace:=wdReplaceOne
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseEnd
            Else
                .Collapse Direction:=wdCollapseStart
            End If
            .Find.Execute
        End With
        With Selection
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseStart
            Else
                .Collapse Direction:=wdCollapseEnd
            End If
            .Find.Execute Replace:=wdReplaceOne
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseEnd
            Else
                .Collapse Direction:=wdCollapseStart
            End If
            .Find.Execute
        End With
        With Selection
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseStart
            Else
                .Collapse Direction:=wdCollapseEnd
            End If
            .Find.Execute Replace:=wdReplaceOne
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseEnd
            Else
                .Collapse Direction:=wdCollapseStart
            End If
            .Find.Execute
        End With
        With Selection
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseStart
            Else
                .Collapse Direction:=wdCollapseEnd
            End If
            .Find.Execute Replace:=wdReplaceOne
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseEnd
            Else
                .Collapse Direction:=wdCollapseStart
            End If
            .Find.Execute
        End With
        With Selection
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseStart
            Else
                .Collapse Direction:=wdCollapseEnd
            End If
            .Find.Execute Replace:=wdReplaceOne
            If .Find.Forward = True Then
                .Collapse Direction:=wdCollapseEnd
            Else
                .Collapse Direction:=wdCollapseStart
            End If
            .Find.Execute
        End With
        Selection.Find.Execute Replace:=wdReplaceAll
    End Sub
      

  2.   

    support.microsoft.com/?kbid=183369
    support.microsoft.com/support/KB/Articles/Q194/9/06.asp
    http://www.kayodeok.btinternet.co.uk/favorites/kbofficewordhowto.htm
    use vtmissing for optional parameters 
    http://support.microsoft.com/kb/295692
      

  3.   

    主要是ClearFormatting在vc中怎么实现
    还有Find的属性设置对应msword9.h中的那个函数
      

  4.   

    没有找到关于文件替换的 主要就是哪个Find、 Replacement 和 ClearFormatting不知道在msword9.h中对应的哪几个函数
      

  5.   

    为什么selection对象没有find方法?
      

  6.   

    我也遇到了同样的问题,能帮个忙,共享下吗??!!!
    感激!!!!!!
    邮箱:
    [email protected]
      

  7.   

    也请发给我,十分感谢!
    邮箱:[email protected]
      

  8.   

    find 类 和replacement 类成员函数怎么用,才能实现替换啊? 能给一段程序吗?