Solved

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

Posted on 2011-03-18
3
1,258 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

746 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now