How to remove the entire line of a word doc using vba

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

or in one step:


If 'deleting the line' means deleting just one line of a paragraph, the following is the way:

Selection.HomeKey wdLine
Selection.EndKey wdLine, wdExtend

Need Your Help

Pig Cassandra process very slow (Heart beat) with oozie

hadoop cassandra apache-pig oozie

I have a pig script which will get all the data from cassandra, do little transformation and store onto hdfs. When I execute it on the grunt console of pig, it takes nearly 30 min since there are l...

WPF Datagrid cell tooltip

wpf datagrid linq-to-entities tooltip

I have a WPF 4.0 DataGrid displaying data from a LINQ to Entities query. The query returns an anonymous list so the DataGrid has its AutoGenerateColumns property set to true.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.