words.ActiveDocument.ActiveWindow.ActivePane.View.SeekView = 10
    words.Selection.HomeKey 6
    words.Selection.HomeKey 5
    words.Selection.Find.ClearFormatting
    With words.Selection.Find
        .Text = "序號"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchByte = True
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = False
        .MatchFuzzy = False
    End With
    words.Selection.Find.Execute
    words.Selection.EndKey 5, 1
    txt = words.selection.range.text
    以上是获取页尾的,求页眉,和word 文本框里的内容怎么获取?急急急急急?

解决方案 »

  1.   

    在Word2003中开始记录宏,手动完成所需功能,结束记录宏,按Alt+F11键,查看刚才记录的宏对应的VBA代码。
      

  2.   

    不懂啊,我不是学vbs的,所有想请教一下这个问题,因为公司突然要我做这个,郁闷
      

  3.   

         words.ActiveDocument.ActiveWindow.ActivePane.View.SeekView = 1
         words.Selection.EndKey 5, 1
         txt = words.Selection.Range.Text