How do you print one tab in portrait and other tabs in landscape?

  • Thread starter Joe (Portrait & Landscape)
  • Start date
J

Joe (Portrait & Landscape)

I have 6 tabs with different diagrams on each page. Page one is oriented in
Portrait setting. Pages 2-6 are in a Landscape orientation. How do I print
the entire document without having to switch back and forth between portrait
and landscape settings.

Currently, I go to Print Setup and set Portrait. Print page 1. Then go
back to Print Setup and set Landscape. Print pages 2-6. The reason I do
this is once I set either Portrait or Landscape, all six pages print in the
orientation that is set.

Is there a way to set the orientation of each page/tab irrespective of the
other pages?

Thanks.
 
J

John Goldsmith

Hello Joe,

Yes, Visio 'Page Setup' is on a per page basis so you can certainly have
independent settings for each page. (Note this is good for 2003 / 7. What
version are you on?)

Best regards

John

John Goldsmith
www.visualSignals.co.uk

"Joe (Portrait & Landscape)" <Joe (Portrait &
Landscape)@discussions.microsoft.com> wrote in message
news:[email protected]...
 
J

Joe (Portrait & Landscape)

Unfortunately, I am on Visio 2002. I can tough it out until I get a newer
version (assuming there is no solution with my version). Thanks.
 
J

John Goldsmith

Hello Joe,

2002 print pages are, as you've discovered, on a per document basis I'm
afraid. So you've got two choices. Either upgrade to 2007 or try out the
code below:

Sub PrintDocPages()
Dim pag As Page
Dim objTempPage As Object
Dim sTempVar As String

For Each pag In ThisDocument.Pages
If Not pag.Background = True Then
If pag.PageSheet.CellsU("PageWidth").ResultIU > _
pag.PageSheet.CellsU("PageHeight").ResultIU Then
ThisDocument.PrintLandscape = True
Else
ThisDocument.PrintLandscape = False
End If
Set objTempPage = pag
sTempVar = objTempPage.Print
End If
Next pag
End Sub

The above code should print the individual pages to the default printer,
changing the printer page orientation for each page based on the drawing
page orientation.

If you've not tried any code before and think the above looks a little
daunting, just have a try with the steps below:

1) Create a copy of your document (just to ensure you're happy with the
results).

2) Press alt+F11 to open the VBA editting window (VBE).

3) In the VBE click Insert / Module and paste the code above into the new
blank area on the right.

4) Press F5 to run the procedure and with any luck you see some output in
your printer.

Hope that helps.

Best regards

John


John Goldsmith
www.visualSignals.co.uk

"Joe (Portrait & Landscape)"
 
J

Joe (Portrait & Landscape)

John,

I did what you described and but when I printed everything out, it still
prints everything in the Portrait (or whatever I have selected). So the
diagram is cut off. The pg 2, 3, 4, 5, & 6 diagrams are oriented one way
(landscape) and the 'white sheet' is displayed in the orientation that is set
(portrait).

Is there another way around this?

Joe
 
J

Joe (Portrait & Landscape)

Thanks John. I appreciate your help. Do you work for Microsoft or are you
just a computer Good Samaritan?

Joe
 
J

John Goldsmith

Hello Joe,

Well here's your amended code. Previous was my fault as each test of the
page to see if it was Landscape was changing all subsequent pages. No good
at all!

So, a better strategy might be to get an array of page orientations before
you make changes and then carry out the printing process. Note that I've
set the code to close the document unsaved after it finishes printing so
that it retains your original page orientations. this means that if you
want to make any changes you must save the document prior to running this
procedure.

Sub PrintDocPages()
Dim pag As Page
Dim objTempPage As Object
Dim sTempVar As String
Dim vPagesArray() As Variant
Dim iForegndPages As Integer
Dim i As Integer
Dim j As Integer

If MsgBox("This print procedure will close the " & _
"document after it has finished WITHOUT saving. " & _
"All changes will be lost. Do you wish to continue?", _
vbYesNo, "Print Document") = vbYes Then

'Get the number of foreground pages
iForegndPages = ThisDocument.Pages.Count
For Each pag In ThisDocument.Pages
If pag.Background = True Then
iForegndPages = iForegndPages - 1
End If
Next pag

'Setup the page perspective array
ReDim vPagesArray(iForegndPages - 1, 1) As Variant

'Populate the pages perspective array
For i = 1 To ThisDocument.Pages.Count
Set pag = ThisDocument.Pages(i)
If Not pag.Background = True Then
vPagesArray(i - 1, 0) = i
If pag.PageSheet.CellsU("PageWidth").ResultIU > _
pag.PageSheet.CellsU("PageHeight").ResultIU Then
vPagesArray(i - 1, 1) = 1
Else
vPagesArray(i - 1, 1) = 0
End If
End If
Next i

'Print out based on array
For j = 0 To UBound(vPagesArray())
Set pag = ThisDocument.Pages(j + 1)
ThisDocument.PrintLandscape = vPagesArray(j, 1)
Set objTempPage = pag
sTempVar = objTempPage.Print
Next j

'Close file without saving to retain
'original page setups
ThisDocument.Saved = True
ThisDocument.Close

Else
Exit Sub
End If

End Sub

Hope that helps.

Best regards

John


John Goldsmith
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 
J

Joe (Portrait & Landscape)

John,

Unless I've done something wrong that is obvious, I'll just continue to
print a range of pages in Portrait, then switch the page setup to landscape
and print the other range of pages, and then hope that my boss gets me a
newer version of MS Visio at some point in the near future.

1) I used Alt-F11 to get to VBA
2) I used Insert-Module
3) I cut and pasted your new code
4) I hit F5 and a window popped up that said that it would print but not
save (which
I was OK with, so I clicked "Yes").
5) The printouts were all in the same orientation (portrait) and then I
tried the
same procedure in landscape and got the same results in the same
orientation.
6) I tried saving this and then printing from the regular MS Visio
application but that didn't work either.

I appreciate all of your help and I'm sure the positive computer karma will
be returned to you for trying.

Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top