Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-26-2012, 12:09 PM
maceslin maceslin is offline Windows 2K Office 2007
Novice
 
Join Date: Jul 2012
Posts: 4
maceslin is on a distinguished road
Default How to stop a macro

I have created a macro to underline and change the color of the word(s) that I select using the macro builder. Macro works great when I execute but it will not "turn off", everything I type after highlighting my word(s) is in this format, it should only be the word(s) I select.

Here is the code

Code:
Sub NWDCtextin()
'
' NWDCtextin Macro
'
'
    Selection.Font.UnderlineColor = wdColorAutomatic
    Selection.Font.Underline = wdUnderlineSingle
    Selection.Font.Color = wdColorBlue
End Sub
Thanks for lookin'


Dave
Reply With Quote
  #2  
Old 07-26-2012, 03:38 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,352
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Hi Dave,

That's because anything you type immediately after something that has a particular attribute inherits that attribute. If you leave a space after the selection before running the macro, all should be fine.

BTW, the better way to do this would be to define a character Style with the attributes you want.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 07-27-2012, 04:38 AM
maceslin maceslin is offline Windows 2K Office 2007
Novice
 
Join Date: Jul 2012
Posts: 4
maceslin is on a distinguished road
Default

Quick style was the way to go

Thanks
Reply With Quote
Reply
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop macro "IF" coxjamd Excel Programming 2 03-01-2012 02:40 PM
Start and stop an executeble from vba remmyMartin Outlook 0 01-12-2012 08:09 AM
How to stop repaginating ictodd Word 4 09-05-2011 02:57 AM
Video clip stop pf36 PowerPoint 0 04-16-2010 07:29 AM
GIF's stop working Kwarior PowerPoint 3 03-17-2010 09:59 PM


All times are GMT -7. The time now is 03:00 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft