Solved

Apply page setup on multiple excel files

Posted on 2011-09-13
3
196 Views
Last Modified: 2012-06-22
I have around 50 excel files and I want to change the page setup on all the files to have the same settings (Page margin, page orientation, column width, row width, etc).

What would be the best way to change the page setup on all files without manually change each file at a time?
0
Comment
Question by:coronoahcoro
3 Comments
 
LVL 4

Accepted Solution

by:
grogman earned 500 total points
ID: 36530248
Simplest method I can think of (if you don't have much experience writing/modifying VBA code) would be to record a macro, store it in Personal Macro Workbook so it will be available regardless of open file, and while recording, set your page setup preferences exactly how you want them for the first file. Stop recording, then open each of the other files and run the recorded macro against them one at a time, saving changes to each file. This will automate the process of applying all of your settings. Granted, you will still need to open and save each file, but getting your page setup options applied will only take a couple of clicks.
0
 
LVL 2

Author Comment

by:coronoahcoro
ID: 36530299
I have some experience with modifying VBA code. What would be the best way with VBA code?
0
 
LVL 4

Expert Comment

by:SafetyFish
ID: 36530374
If, for instance, all the files are in a single folder you can write a loop to loop through all the files in the folder, check their extension for a .xls or .xlsm, etc, open them, apply the page setup settings change, save and close them again.

The only tricky part of this is getting the file location strings right, but that is generally not so hard.

http://vbatutor.blogspot.com/2009/02/excel-vba-macro-example-opening-closing.html

http://excelexperts.com/VBA-Tips-List-Files-In-A-Folder

Those should get you started :)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question