以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  删除word页眉下划线  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=140547)

--  作者:fntfgz
--  发布时间:2019/9/8 8:36:00
--  删除word页眉下划线

老师,我在删除word页脚的过程中,个别文档会出现页眉出现下划线,如下图所示

 


图片点击可在新窗口打开查看此主题相关图片如下:2019-09-08_074400.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


--  作者:fntfgz
--  发布时间:2019/9/9 9:04:00
--  
老师,有时间吗,帮看看我的问题
--  作者:有点蓝
--  发布时间:2019/9/9 9:53:00
--  
文档发上来测试
--  作者:fntfgz
--  发布时间:2019/9/9 10:16:00
--  

老师,费心了,确实不是所有的文档都会出现问题,老师看看这个,看看是什么问题,怎么解决

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:55-2010年高考缺考录入工作要点.rar

[此贴子已经被作者于2019/9/9 10:17:09编辑过]

--  作者:有点蓝
--  发布时间:2019/9/9 10:38:00
--  
 myRange2.ParagraphFormat.Borders(MSWord.WdBorderType.wdBorderBottom).LineStyle = MSWord.WdLineStyle.wdLineStyleNone