Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20755

Opening Printer Proprties with space in the printer name.

$
0
0

This code opens a specified printer's Printer Properties. It works if there are no spaces in the printer name: if the printer is named TestThisPrinter, it works. If it is named "Test This Printer" it does not. I get a message that says "Printing preferences cannot be displayed. Double check the printer name and make sure that the printer is connected to the network.

 

I suppose I could remove the spaces from the printer names to be tested, but I really would not like to do that. Does anyone have any idea how I can get this to work with spaces in the printer name?

 

I am using TestComplete 7.52 (Yes, I know it is old) in Windows 10.

 

Thanks.

 

sub Test1

  Call OpenPrinterProperties("Test This Printer")

end sub

 

sub OpenPrinterProperties(PRName)

  Dim WshShell, oExec

  Set WshShell = CreateObject("WScript.Shell")

 

  Set oExec = WshShell.Exec("rundll32 printui.dll,PrintUIEntry /e /n\\" & Sys.HostName & "\" & PRName)

 

end sub


Viewing all articles
Browse latest Browse all 20755

Trending Articles