Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro for Microsoft Word to Make everything fit on one page

Status
Not open for further replies.

Katz22

Technical User
Mar 16, 2007
7
US
I need a document to automatically format to fit to one page.

I am sending out credit apps to customers, and they keep making a mistake on the form by making it spill onto two pages. I get so many, that it would just be easier to embed something in the form to make it automatically format to one page.

Any tips?

If so, could some write the macro for me (i am a complete newb) and also tell me where/how to install it.

Thanks so much!

Check my post in this thread:

 
A starting point:
On Error Resume Next
ActiveDocument.FitToPages

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PH, thanks for the response. where would i put that code...?
 
Just before printing ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I guess I am too much of a beginner to understand that....

my thought was....

that i could install a macro...that when the document is opened, if it is more than 1 page, it would shrink it down to 1 page right away automatically.

I appreciate the help, but if you could elaborate a little more on your response.

Thanks.
 
In the Open event procedure of the document:
Private Sub Document_Open()
On Error Resume Next
ThisDocument.FitToPages
End Sub

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
It doesn't seem to be working, I guess I am doing it wrong.

I am going into the visual basic editor, pasting the code you have, saving and then closing the VB editor.

Then to test it, i am making the doc go to two pages...saving it, closing it...then double clicking it on my desktop....and it is still on two pages..

what am i doing wrong?
 
To be sure the event is fired add the following line in the code:
MsgBox "Open event fired"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Its not working...maybe I could send it to you?

If not, its cool. Ill keep working on it.

Thanks for your time.
 
So, get rid of that you have.
In the VBE, open the Project browser (Ctrl+R) and double click the ThisDocument object.
You may now paste the whole procedure in the code window.
Return to the document and verify the macro security level:
menu Tools -> Macro -> Security ...
The level shouldn't be higher than middle.


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I would like to remind that FitToPages uses font size changes to do it, AND it only actions the document by reducing the font size in order to reduce the page count by ONE. That is, executing FitToPages on a four page document will make it three pages. Three page document to two. Thirteen page document to twelve, etc.

This is not an issue for you if you are only dealing with two pages to one.

May I ask what is the actual problem with the document going to two pages?

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top