PDA

View Full Version : Solved: Change page setup on all open documents



3Cees
04-25-2007, 07:26 AM
Hi there - first post

I'm on here all the time. I have never been taught how to program and I make my macros by recording them or copying the text from here.

I have the "print all open documents" macro running but the problem i have is that when i have my 30 or so documents open, they're all in various stages of page-setup (all picking arbitrary trays to print from in the printer) and most of them come out on the wrong paper.

The obvious solution to this of course is to change the page-setup to the correct bins in the printer every time (which i have a macro for to change the page-setup)


Sub PageSetupTrayTwo()
'
' PageSetupTrayTwo Macro
' Macro recorded 04/10/2005
'
With ActiveDocument.Styles(wdStyleNormal).Font
If .NameFarEast = .NameAscii Then
.NameAscii = ""
End If
.NameFarEast = ""
End With
With ActiveDocument.PageSetup
.FirstPageTray = wdPrinterLowerBin
.OtherPagesTray = wdPrinterLowerBin
.DifferentFirstPageHeaderFooter = True
.PageWidth = InchesToPoints(8.27)
.PageHeight = InchesToPoints(11.69)
End With
End Sub


and then print each one but then this of course would defect the purpose of the "print all open documents" macro...




Sub PrintAll()


Dim objDoc As Document


On Error Resume Next


For Each objDoc In Application.Documents
objDoc.PrintOut
Next objDoc


Set objDoc = Nothing


End Sub




The thing is, i know how its frowned upon here not to even try and get the code but I?ve been trying to run a mix of a page-setup macro and print all open documents macro all day and as I mentioned before, i'm not a coder i don?t know what I?m doing.

I would really appreciate if someone could tell me how to run a macro that changes the file setup to a specic thing on ALL the documents currently open.

Please and smiley thanks in advance.

Cecelia

3Cees
04-25-2007, 07:35 AM
I meant to add as well, each document/letter gets printed twice, each time on different paper in various combinations from the bins in the printer (file copies etc) hence no universal "default" page setup.

Ta.

3Cees
05-10-2007, 06:47 AM
Managed to manipulate the "print all"... And after several permutations got something that works...


Sub ChangePageSetupAllDocsTray3()

Dim objDoc As Document

On Error Resume Next

For Each objDoc In Documents

With objDoc.PageSetup
.FirstPageTray = wdPrinterLargeCapacityBin
.OtherPagesTray = wdPrinterLargeCapacityBin

End With
Next objDoc

End Sub

Thanks a mil.