![]() |
|
#2
|
||||
|
||||
|
It is better to delete the paragraph at the time of writing the userform fields to the document but you haven't shown us your code.
This code can be used after you have populated the bookmarks. It doesn't query the text in the bookmark itself since it is likely your code is adding the text beside the bookmarks rather than inside them. If Len(ActiveDocument.Bookmarks("aa").Range.Paragraph s(1).Range) = 1 Then ActiveDocument.Bookmarks("aa").Range.Paragraphs(1) .Range.Delete End If With your second question, this should definitely be handled at the time of writing the userform values. If Len(Me.BusinessName) = 0 then ActiveDocument.Bookmarks("ab").Range.Text = Me.ContactName Else ActiveDocument.Bookmarks("ab").Range.Text = Me.BusinessName End If Note that this code doesn't actually fill the bookmark and may also actually delete the bookmark which is a pain I alluded to in the initial code. To populate the bookmark ranges 'properly' you would need to look at this info http://word.mvps.org/faqs/macrosvba/...hBookmarks.htm |
| Tags |
| paragraph bookmark blank |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Why when I paste text into word, blank space appears after a paragraph & I can't delete it?
|
AWD | Word | 3 | 10-16-2018 01:10 PM |
Calculate the coordinates of a DocVariable, Bookmark or paragraph.
|
MaxInCO | Word VBA | 5 | 12-11-2013 03:28 PM |
Delete Range After Bookmark?
|
VBA_Elfe | Word VBA | 3 | 04-05-2013 05:05 AM |
delete all bookmark text
|
hklein | Word VBA | 4 | 08-10-2011 04:33 AM |
Newbie: Delete Bookmark
|
expatriate | Word VBA | 4 | 06-02-2011 01:12 AM |