Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 08-26-2014, 08:00 AM
WH7262 WH7262 is offline Windows Vista Office 2007
Novice
 
Join Date: Aug 2014
Location: Texas
Posts: 7
WH7262 is on a distinguished road
Default Looping Macro to Change Font, Font Size, and Give Heading 1

I need a repeating macro that could do the following in a specified folder:

1. Change all Fonts to Times New Roman
2. All font size to 12
3. Then have the first line of text to have a Style of Heading 1
4. Save the file as .doc

Then possibly have it call another macro to have it do a Save As .docx
Here is the macro I have now.
Sub PageTxtFontHeader1()
' ' PageTxtFontHeader1 Macro ' '
With Selection.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = InchesToPoints(0.6)
.BottomMargin = InchesToPoints(0.6)
.LeftMargin = InchesToPoints(0.6)
.RightMargin = InchesToPoints(0.6)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.PageWidth = InchesToPoints(8.5)
.PageHeight = InchesToPoints(11)


.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = False
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
Selection.WholeStory
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 12
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdStory
Selection.Style = ActiveDocument.Styles("Heading 1")
End
Sub

How can I get this to repeat on all of the files in that folder?

Last edited by WH7262; 08-26-2014 at 08:37 AM. Reason: Giving more details
Reply With Quote
  #2  
Old 08-26-2014, 03:46 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,342
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

Cross-posted and answered at: http://answers.microsoft.com/en-us/o...50c2#LastReply
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184

See also: http://windowssecrets.com/forums/sho...l=1#post960703

PS: When posting code, please post formatted code and use the code tags. They're on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Tags
format style, loop, repeating
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change in font size of docproperty Sandy27 Word 9 01-03-2014 01:51 PM
Unable to change font size Andoheb Outlook 1 11-23-2012 07:24 PM
how change size font to inches size kkepo Word 4 08-28-2012 08:53 PM
Change font & point size? markg2 Outlook 2 06-09-2010 03:23 PM
Can't change font type or size sideways Word 2 11-01-2009 09:57 AM


All times are GMT -7. The time now is 02:22 PM.


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