Forum Discussion

rlent's avatar
rlent
Contributor
10 years ago

Opening Printer Proprties with space in the printer name.

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...
  • TanyaYatskovska's avatar
    10 years ago

    Hi Rlent,

     

    TestComplete 7.52 and Windows 10 are already strange combination :) TestComplete 7.52 doesn’t officially supports the latest Windows version. So, everything you do on this computer you are doing at your own risk – we cannot guarantee that TestComplete 7 will work fine.

     

    As for your question, when there are spaces in a path, you need to put the text into quotes to pass it as a parameter, like "Test This Printer". So, modify the execution line something like this:

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

     

     

  • rlent's avatar
    rlent
    10 years ago

    That didn't work for me, but it pointed me in the righ direction. What did work for me was:

     

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

     

    Thanks!