Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-14-2017, 08:22 AM
CrossReach CrossReach is offline Can Macros Automatically Format an Entire Document to My Specifications Windows 10 Can Macros Automatically Format an Entire Document to My Specifications Office 2016
Advanced Beginner
Can Macros Automatically Format an Entire Document to My Specifications
 
Join Date: Jun 2015
Location: In my head
Posts: 70
CrossReach is on a distinguished road
Default Can Macros Automatically Format an Entire Document to My Specifications

I have a number of different formats I use in my work with Word. Different pages sizes being the main one, but then different margin sizes, font sizes, table settings etc within those page sizes.



My question is would it be possible to create a series of macros that, with the click of a button, I change a document into those varying formats and their specific requirements within?
Reply With Quote
  #2  
Old 11-14-2017, 08:59 AM
slaycock slaycock is offline Can Macros Automatically Format an Entire Document to My Specifications Windows 7 64bit Can Macros Automatically Format an Entire Document to My Specifications Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

Yes. But if the format doesn't change during the life of a document you'd be much better just setting up a series of templates.

If you need to completely alter the formatting of a document depending on where it is going then macros may be a solution.
Reply With Quote
  #3  
Old 11-14-2017, 10:23 AM
CrossReach CrossReach is offline Can Macros Automatically Format an Entire Document to My Specifications Windows 10 Can Macros Automatically Format an Entire Document to My Specifications Office 2016
Advanced Beginner
Can Macros Automatically Format an Entire Document to My Specifications
 
Join Date: Jun 2015
Location: In my head
Posts: 70
CrossReach is on a distinguished road
Default

I have to transfer the contents from a particular program to Word and when I do the original formatting remains, even though I already have certain specifications like font type, font size, margins and indentations etc. set up. So what would be amazing is to be able to click a button and have it all reformatted as I need.
Reply With Quote
  #4  
Old 11-14-2017, 10:43 AM
slaycock slaycock is offline Can Macros Automatically Format an Entire Document to My Specifications Windows 7 64bit Can Macros Automatically Format an Entire Document to My Specifications Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

Then the answer is that a suite of macros is probably the best option. Good luck. I've spent the last 9 months doing something similar. It can be a big job. Working with styles in VBA can be an enormously frustrating exercise.
Reply With Quote
  #5  
Old 11-14-2017, 12:51 PM
macropod's Avatar
macropod macropod is offline Can Macros Automatically Format an Entire Document to My Specifications Windows 7 64bit Can Macros Automatically Format an Entire Document to My Specifications Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Here's some basic code to do an A4 setup.
Code:
Sub A4Format()
Application.ScreenUpdating = False
With ActiveDocument
  With .Range.PageSetup
    .BookFoldPrinting = False
    .BookFoldRevPrinting = False
    .PaperSize = wdPaperA4
    .TopMargin = CentimetersToPoints(2.5)
    .BottomMargin = CentimetersToPoints(2.5)
    .LeftMargin = CentimetersToPoints(2.5)
    .RightMargin = CentimetersToPoints(2.5)
    .MirrorMargins = False
  End With
End With
Application.ScreenUpdating = True
End Sub
Of course, if you have a mix or portrait and landscape Sections and you want different margins for each, you'll need to process them individually.

As for fonts, indents, etc., if the source documents have used Styles consistently, that part of the job is simply a matter of changing the Style definitions; otherwise it's a case of iterating through the paragraphs and updating them individually (perhaps even applying Styles to ensure conformity to corporate standards and simplify future updates).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can Macros Automatically Format an Entire Document to My Specifications Attempting to find text, select words before it, and format the entire selection KeviM Word VBA 1 04-07-2017 05:36 PM
Create a dynamic document (Specifications on RFP) HOPAL Word 1 04-05-2017 11:19 AM
Single step Word Styles from Source Document through entire Destination document? xbliss Word 6 08-27-2016 09:36 PM
Can Macros Automatically Format an Entire Document to My Specifications How to automatically enable the macros upon opening a file with macros? laurieli Office 7 01-17-2016 08:56 AM
How to automatically enable macros upon opening the Word? laurieli Word VBA 2 12-22-2015 02:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:10 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