Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2015, 10:10 AM
fremoy fremoy is offline what functions would this task use, format, macro ? etc Windows 7 64bit what functions would this task use, format, macro ? etc Office 2013
Novice
what functions would this task use, format, macro ? etc
 
Join Date: Feb 2015
Posts: 2
fremoy is on a distinguished road
Default what functions would this task use, format, macro ? etc

Hi all,


I'm looking to take a txt document like below

[IMG][/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.
Reply With Quote
  #2  
Old 02-11-2015, 10:59 PM
Guessed's Avatar
Guessed Guessed is offline what functions would this task use, format, macro ? etc Windows 7 32bit what functions would this task use, format, macro ? etc Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
And you also should edit the Heading 1 style to get those headings to your desired look too.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 02-16-2015, 10:48 AM
fremoy fremoy is offline what functions would this task use, format, macro ? etc Windows 7 64bit what functions would this task use, format, macro ? etc Office 2013
Novice
what functions would this task use, format, macro ? etc
 
Join Date: Feb 2015
Posts: 2
fremoy is on a distinguished road
Default

thanks Andrew, i sent you a PM.

Regards
Mark.
Reply With Quote
Reply

Tags
macro, template, vb

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
what functions would this task use, format, macro ? etc Macro to format unpredictable data Nisio07 Excel 2 09-30-2014 01:16 PM
what functions would this task use, format, macro ? etc Copy and Paste of a Task...Including all of the Task's 'children'...to a new task KRTSTARRYNIGHT Project 1 07-01-2014 06:54 AM
what functions would this task use, format, macro ? etc Find and Replace Format macro issue Jack Word VBA 2 12-12-2012 09:24 PM
what functions would this task use, format, macro ? etc macro to format this ubns Word 3 04-24-2012 11:44 PM
what functions would this task use, format, macro ? etc Need a macro to convert all graphics to GIF format sleake Word VBA 3 02-10-2012 05:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:25 AM.


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