Problems testing for / setting properties on a printer.

E

Ebbe

Hi

I want to make use of some printer capabilities (orientation, duplex and
trays).
How can I determine what capabilities is available?

In spite of knowing what a specific printer can, it is not possible to catch
the VBA code, by using the macro recorder, that select the properties.
How can I set the printer properties by using VBA?

I am using Office 2003

Ebbe
 
J

Jay Freedman

Hi

I want to make use of some printer capabilities (orientation, duplex and
trays).
How can I determine what capabilities is available?

In spite of knowing what a specific printer can, it is not possible to catch
the VBA code, by using the macro recorder, that select the properties.
How can I set the printer properties by using VBA?

I am using Office 2003

Ebbe

See these articles, especially the second and fourth ones:

http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=101
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=116
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=132
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=183
 
E

Ebbe

Hi Jay!

Now I have tried to set the Duplex property, but it doesn't work.
I have tried to walk through in the debugger, but I don't see any problems.
Then I inserted an extra GetDuplex after the SetDuplex, and it shows that
the code isn't changed.

Sub PrintDuplexBooklet()

Dim iDuplex As Long
Dim iDuplex2 As Long

iDuplex = GetDuplex ' iDuplex Shows 1
SetDuplex 3 'set for vertical binding
iDuplex2 = GetDuplex ' iDuplex2 Shows STILL 1 :-(

ActiveDocument.PrintOut Background:=False
SetDuplex iDuplex 'restore the original setting

End Sub

Any idears?

Ebbe
 
J

Jonathan West

This area of programming is notoriously difficult to manage. Some questions.

1. Is the printer local or networked?

2. If networked, have you installed a local printer driver?

3. Can you change the duplex setting through the printer properties page?

4. Have you managed to change any of the other properties of the printer by
code? If so, which?


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org




Ebbe said:
Hi Jay!

Now I have tried to set the Duplex property, but it doesn't work.
I have tried to walk through in the debugger, but I don't see any
problems.
Then I inserted an extra GetDuplex after the SetDuplex, and it shows that
the code isn't changed.

Sub PrintDuplexBooklet()

Dim iDuplex As Long
Dim iDuplex2 As Long

iDuplex = GetDuplex ' iDuplex Shows 1
SetDuplex 3 'set for vertical binding
iDuplex2 = GetDuplex ' iDuplex2 Shows STILL 1 :-(

ActiveDocument.PrintOut Background:=False
SetDuplex iDuplex 'restore the original setting

End Sub

Any idears?

Ebbe
 
E

Ebbe

1: Yes, the printer is attached to the network.
2: Yes, I have the driver installed locally
3: Yes, I can change the Duplex property by the property window.
4: No, I have not tried to change other properties by code.

Some more information:
I discovered that setting duplex to long edge or short edge thrugh the
property window the GetDuplex function in both cases returned 2 and it
returned 1 when duplex was set to "None"

Ebbe

Jonathan West said:
This area of programming is notoriously difficult to manage. Some
questions.

1. Is the printer local or networked?

2. If networked, have you installed a local printer driver?

3. Can you change the duplex setting through the printer properties page?

4. Have you managed to change any of the other properties of the printer
by code? If so, which?


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
E

Ebbe

Hi Jonathan

Now I have reinstalled the printer incl. drivers.
This time I have connected it through the USB port.

Manipulating the propertied through control panel works.
But if I try changing properties by using VBA it does NOT works.

Any ideas?

Ebbe

Jonathan West said:
This area of programming is notoriously difficult to manage. Some
questions.

1. Is the printer local or networked?

2. If networked, have you installed a local printer driver?

3. Can you change the duplex setting through the printer properties page?

4. Have you managed to change any of the other properties of the printer
by code? If so, which?


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
E

Ebbe

Hi Jonathan again - again

Now it seems to work!
I have substituted the printerdriver delivered with the printer on a CD with
one downloaded.

Thanks to all trying to help
Ebbe
Jonathan West said:
This area of programming is notoriously difficult to manage. Some
questions.

1. Is the printer local or networked?

2. If networked, have you installed a local printer driver?

3. Can you change the duplex setting through the printer properties page?

4. Have you managed to change any of the other properties of the printer
by code? If so, which?


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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