PrintRange visPrintAll

J

John

Hi there,

I'm currently having trouble with printing. The issue is that only the
first page is being printed out of a document that contains at least eight
pages? I'm using the following code:

Application.ActiveDocument.PrintOut PrintRange:=visPrintAll,
PrinterName:="Acrobat Distiller"

I assumed the "visPrintAll" would do the job but for some reason it only
chucks out the first page.

Any clues? (I'm running this code from a separate stencil that opens with
the file in question.)

Thanks once again.

John
 
A

Al Edlund

when I tried it (in VB) the compiler came back with
Application.ActiveDocument.PrintOut visPrintAll, , , , "Acrobat Distiller"
Al
 
J

John

Hi Al,

Thanks for this but it just seems to do the same thing. I got the original
code by recording a macro of File/Print.... etc. which did print all of the
pages, but when you run the code by itself it only prints out the first page
(yours and mine)!

This is driving me up the wall! Can you or anyone else shed some more
light?

Thanks

John
 
K

Kari Yli-Kuha

John said:
Hi Al,

Thanks for this but it just seems to do the same thing. I got the original
code by recording a macro of File/Print.... etc. which did print all of the
pages, but when you run the code by itself it only prints out the first page
(yours and mine)!

This is driving me up the wall! Can you or anyone else shed some more
light?

We ran into the same problem (Visio 2003) - despite documentation
'visPrintAll' seems to print only the first page.

But, you can come down from the wall, this worked for us:

Application.ActiveDocument.PrintOut visPrintFromTo, FromPage:=1, _
ToPage:=Application.ActiveDocument.Pages.Count

so, use 'visPrintFromTo' instead.

/C
 
J

John

Kari,

Many thanks. I'm now back on the ground thanks to your help! The only part
I seemed to have a problem with was "Pages.Count" part, which I guess
included the background pages. This seemed to upset Distiller which fell
over when trying to print. In the end, I've adapted some code from the help
file to count the number of foreground pages only and pass this to the print
routine.

Whilst I'm sure there are slicker ways of doing this, it seems to work, so
for the benefit of other newbies please find below.

Thanks again Kari for setting me on the right path.

Best regards

John


Sub PrintForegroundPages()

Dim fPgCount As Integer 'Foreground page count
Dim vsoPages As Visio.Pages
Dim vsoPage As Visio.Page
Dim intCounter As Integer

'Set foreground page count to 0
fPgCount = 0

'Get the Pages collection.
Set vsoPages = ActiveDocument.Pages

'Iterate through the collection.
For intCounter = 1 To vsoPages.Count

'Retrieve the Page object at the current index.
Set vsoPage = vsoPages(intCounter)

'Check whether the current page is a background page.
If vsoPage.Background = False Then

fPgCount = fPgCount + 1

End If

Next intCounter

'Print out foreground pages
Application.ActiveDocument.PrintOut visPrintFromTo, 1, fPgCount, ,
"Acrobat Distiller"

End Sub
 

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