Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-12-2012, 02:52 PM
macropod's Avatar
macropod macropod is offline Formatting with macros Windows 7 64bit Formatting with macros Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,520
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

See the macro here for a comprehensive solution: https://www.msofficeforums.com/word/...html#post32907
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 05-13-2012, 12:44 PM
WaltR WaltR is offline Windows Vista Office 2007
Competent Performer
Formatting with macros
 
Join Date: Dec 2010
Posts: 123
WaltR is on a distinguished road
Default

Thanks for the replies, and sorry for posting in the wrong forum. The text of the macro in question is below. I think that's it anyway, I'm fairly new at all this. Can I edit it in some way to prevent the dialogs? If so, please give instructions if possible. I've never done it before but could probably do it if guided through. Thanks a lot.

Code:
Sub Macro2()
'
' Macro2 Macro
' Ctrl+ M Justify several paragraphs
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
  .Text = "zzz^p"
  .Replacement.Text = "zzz"
  .Forward = True
  .Wrap = wdFindAsk
  .Format = False
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
  .Text = "^p"
  .Replacement.Text = " "
  .Forward = True
  .Wrap = wdFindAsk
  .Format = False
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
  .Text = "zzz"
  .Replacement.Text = "^p^p"
  .Forward = True
  .Wrap = wdFindAsk
  .Format = False
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
End Sub

Last edited by macropod; 05-13-2012 at 02:49 PM. Reason: Added code tags & formatting
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting with macros VBA macros tays01s Word VBA 6 08-03-2011 09:42 PM
Macros Steveg Word VBA 0 08-18-2010 04:04 PM
Formatting with macros Macros Desertwrangler Word VBA 6 06-25-2010 07:06 AM
macros trancetheory Outlook 0 05-11-2010 09:31 AM
Formatting with macros Macros krdzal Excel 1 04-06-2010 07:43 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:46 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft