![]() |
#1
|
|||
|
|||
![]()
Hi all,
I'm looking to take a txt document like below [IMG] ![]() and auto format it to like below ![]() what method would be best to do this, so that i can then read up and do it. auto Formatting, macros? etc etc. thanks everyone. Mark. |
#2
|
||||
|
||||
![]()
Based on your provided sample, the following macro would do it all. You may also need to modify the character style 'Emphasis' to get it to look blue.
Code:
Sub FormatText() With AutoCorrect .CorrectInitialCaps = True .CorrectSentenceCaps = True .CorrectDays = True .CorrectCapsLock = True .ReplaceText = True .ReplaceTextFromSpellingChecker = True .CorrectKeyboardSetting = False .DisplayAutoCorrectOptions = True .CorrectTableCells = True End With With Options .AutoFormatApplyHeadings = True .AutoFormatApplyLists = True .AutoFormatApplyBulletedLists = True .AutoFormatApplyOtherParas = True .AutoFormatReplaceQuotes = True .AutoFormatReplaceSymbols = False .AutoFormatReplaceOrdinals = False .AutoFormatReplaceFractions = False .AutoFormatReplacePlainTextEmphasis = False .AutoFormatReplaceHyperlinks = True .AutoFormatPreserveStyles = True .AutoFormatPlainTextWordMail = True End With ActiveDocument.Range.Style = "Normal" ActiveDocument.Kind = wdDocumentNotSpecified ActiveDocument.Range.AutoFormat With ActiveDocument.Range.Find .ClearFormatting .Replacement.ClearFormatting .Replacement.Style = ActiveDocument.Styles("Emphasis") .Text = "\(*\)" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll .Text = "" .Replacement.ClearFormatting .Style = ActiveDocument.Styles("Body Text") .Replacement.Style = ActiveDocument.Styles("List Number") .Execute Replace:=wdReplaceAll End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
![]()
thanks Andrew, i sent you a PM.
Regards Mark. |
![]() |
Tags |
macro, template, vb |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Nisio07 | Excel | 2 | 09-30-2014 01:16 PM |
![]() |
KRTSTARRYNIGHT | Project | 1 | 07-01-2014 06:54 AM |
![]() |
Jack | Word VBA | 2 | 12-12-2012 09:24 PM |
![]() |
ubns | Word | 3 | 04-24-2012 11:44 PM |
![]() |
sleake | Word VBA | 3 | 02-10-2012 05:00 PM |