Word VBA仅删除附录的页码

时间:2017-11-09 22:02:05

标签: vba word-vba

我想删除文档中的页码,只有在附录部分中。有没有办法用IF语句修改下面的代码来检查Section是否是附录样式然后执行?

Sub DeletePageNumbers()

Dim objSect As Section 
Dim objHF As HeaderFooter 
Dim objPNum As PageNumber

For Each objSect In ActiveDocument.Sections

   For Each objHF In objSect.Headers 
       For Each objPNum In objHF.PageNumbers 
           objPNum.Delete 

       Next 
   Next

   For Each objHF In objSect.Footers 
       For Each objPNum In objHF.PageNumbers 
       objPNum.Delete 

       Next 
   Next

Next

End Sub

1 个答案:

答案 0 :(得分:0)

我明白了。见下面的代码

set terminal gif
set xtics rotate
plot    "test.csv" u 0:3:xtic(1) t "Avg" with lines, \
        "test.csv" u 0:4:5:6:7 t "MinMax&Stdv" with candlesticks