Solved

Set US Letter or A4 paper size using Excel VBA and format as appropriate

Posted on 2011-03-18
3
1,278 Views
Last Modified: 2012-06-27
I am collecting data using an Excel user form written in Excel 2007. The data collected then creates a report for the user. Because the volume of data captured on each form is variable I can't use a pre defined template, so instead I create formatted output (borders, emboldening etc) on the fly onto a clean worksheet which I then print.

The same form will be used in US and in Europe, so one of the radio buttons on the form prior to creating the output  is to ask whether the user wants US Letter size paper or European A4 size.

Therefore I'd like some assistance in how to code the following...

1) How to best determine where page breaks should occur for each papersize (I'm thinking some sort of summation of row heights but I could be missing a better way and I don't know what sum of row heights works best for each size)

2) How to create manual page breaks for each papersize based on 1) above using VBA and not have them automated (I may want to break the page earlier if a section is likely to run over two pages)

Any help will be much appreciated

Pete


0
Comment
Question by:pfmurray
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
jerbear1337 earned 500 total points
ID: 35171214
That sounds like a pain. What about just formating it with the length of letter and width of A4 and then setting your page size A4 or letter and then centering the document vertically and horizontal for printing purposes?  I dont know the VBA for that but there is button up top to center vertical and horizontal which can direct you to the VBA obviously if you do record macro and click it.   I know you wont be optimizing the space on both paper formats but it should look acceptable and be a heck of alot easier
0
 

Author Comment

by:pfmurray
ID: 35171756
Hi Jerbear. Thank you for the suggestion. I'll try that and see what happens. The only problem I foresee with vertical centering is that with shorter 2nd or 3rd pages it'll look a bit weird. However it is something I'll experiment with.
0
 

Author Comment

by:pfmurray
ID: 35204943
Hi Jerbear I'm going to award some points to thank you for your suggestion, but I'm going to re-word and re-post the question in the hope someone can point me to the actual VBA.  Thanks again for your time in posting
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

777 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