老师,我在删除word页脚的过程中,个别文档会出现页眉出现下划线,如下图所示
此主题相关图片如下:2019-09-08_074400.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2019-9/201998833657512.png)
我的代码如下:提示wdBorderBottom未定义,老师我的vba只能照猫画虎的改一下,着急用这个功能,烦劳老师,给看看,修改一下
Dim app As New MSWord.Application
try
Dim fileName = "e:\a.doc"
Dim doc = app.Documents.Open(fileName)
For Each oSec As object In doc.Sections
Dim myRange = oSec.Footers(MSWord.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range
myRange.Delete
Dim myRange2 = oSec.Headers(MSWord.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range
myRange2.Delete
myRange2.ParagraphFormat.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
Next
doc.saved = True
doc.ExportAsFixedFormat("e:\w.pdf", MSWord.WdExportFormat.wdExportFormatPDF)
catch ex As exception
msgbox(ex.message)
finally
app.Quit
End try