如何使用VBA删除Word文档的整行 [英] How to remove the entire line of a word doc using vba
本文介绍了如何使用VBA删除Word文档的整行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的代码行将文本插入Word文档中的书签范围.
The following line of code will insert text into a bookmark range in a word document.
objDoc.Bookmarks("DonorAddress").Range.Text = "6200 Main St."
如果我没有任何地址数据,如何删除包含地址书签的整行?
How do I remove the entire line containing the address bookmark if I don't have any address data?
推荐答案
通过删除行",我相信您的意思是删除段落".如果是这样,您可以按照以下方式进行操作:
By 'deleting the line' I believe you mean to 'delete paragraph'. If so you could do it in this way:
'2 steps to delete- rather not recommended
objDoc.Bookmarks("DonorAddress").Range.Paragraphs(1).Range.Select
Selection.Delete
或一步:
objDoc.Bookmarks("DonorAddress").Range.Paragraphs(1).Range.Delete
这篇关于如何使用VBA删除Word文档的整行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文