PDA

View Full Version : Displaying Printer Properties Window



cjmitton
11-13-2013, 05:51 AM
I'm trying to write a macro to open the printer properties window. I've tried to record a macro to find the program / area to run it and I'm getting nothing back. So thought I would run a simple macro to send the key presses to get to printer properties.


Sub PrnProp()
SendKeys "%", True
SendKeys "F", True
SendKeys "P", True
SendKeys "R", True
End Sub



This does not work either any thoughts please?

macropod
11-14-2013, 06:56 PM
How about:

Sub PrnProp()
With Application.Dialogs(wdDialogFilePrint)
SendKeys "%P", True
.Display
End With
End Sub

Frozsh
11-15-2013, 02:21 AM
It worked. how ever if i ran it directly on macro and not on vba. a text "1" is added to the document. but if i run it on vba there is no "1".
i know this is a wrong post but what about on excel? thanks

macropod
11-15-2013, 02:38 AM
if i ran it directly on macro and not on vba. a text "1" is added to the document. but if i run it on vba there is no "1".
I have no idea what you mean.

For Excel, try:

Sub PrnProp()
With Application.Dialogs(xlDialogPrint)
SendKeys "%r", True
.Show
End With
End Sub

Frozsh
11-15-2013, 03:23 AM
the excel macro worked. hmm, about the word.
i tried to open a blank document and go to developer >> visual basic >> paste code>> close vb>> go back to developer tab>> macros>> run prnprop

the dialog box appeared and a number 1 appeared on the document also. I don't know. maybe i got a glitch.

macropod
11-15-2013, 03:36 AM
the dialog box appeared and a number 1 appeared on the document also. I don't know. maybe i got a glitch.
Perhaps so. The code works correctly for me.

cjmitton
11-19-2013, 07:38 AM
Thanks for you replies there, been out of the office for a few days.

The print properties box does appear but I also get the '1' appear on the document in a smaller font????

it is strange but I'll have a play and see what happens.

Thanks.

fumei
11-19-2013, 01:50 PM
Runs fine for me. No "1".

macropod
11-19-2013, 02:28 PM
Likewise, in both Word 2003 & Word 2010. Furthermore, I can't see how the '1' is possible, since there's nothing in the code to produce it.

cjmitton
11-21-2013, 05:31 AM
Thanks, I've had a little play again. I run Word 2010 (32bit) on a Windows 7 Pro 64bit PC. I have all the latest SP and patches loaded, I only get the '1' appear when it try's to send the key press. Its as if it loses control of the window that's appeared and the key press then generates the '1'? I'll try it on my PC at home to see the impact there, its very close now and will be a massive assist to my users.

Sorry for the delay in my reply... up to my neck in work!