Thread: [Solved] Text Spacing in document
View Single Post
 
Old 03-13-2012, 05:00 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Yes, that looks OK, though you don't need the With .. End With structure given you're only doing one thing with the range:
Code:
Private Sub txtEnclosureAttached_Update()
Dim Rng As Range
Set Rng = ActiveDocument.Bookmarks(bmkEnclosureAttached).Range
Rng.Text = Replace(Enclosures.Text, vbCr, ", ")
Application.ScreenRefresh
ActiveDocument.Bookmarks.Add bmkEnclosureAttached, Rng 
End Sub
You also don't need the 'Application.ScreenRefresh' unless it's important to be able to see the document update.

PS: Please use code tags when posting code - you can find them on the Advanced tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote