Argh....AddPrinterConnection aint werking!

Results 1 to 2 of 2

Thread: Argh....AddPrinterConnection aint werking!

  1. #1
    Join Date
    Dec 1969

    Default Argh....AddPrinterConnection aint werking!

    Hi all, long time no post here, but hey I&#039;m back. And I&#039;m well and truly stumped on this little problem...Check out the code prints from a VBScript file (i eventually want to get it to print to Adobe Acrobat to avoid using postscript files!), but for some reason it won&#039;t print. <BR><BR>the code is fine, and it does print (ahem), but only once i have printed a document from an application (like notepad). Does this suggest that I haven&#039;t closed the connections to the printer properly or what? <BR><BR>any help would be great, <BR><BR>Yours, Jonny Tooze <BR><BR>CODE +================================== <BR><BR><BR>Dim strPrinterPath &#039;Form value for Network Path to Printer <BR>Dim strMessage &#039;Form value for Message to Print <BR>Dim objFS &#039;VBScript File System Object <BR>Dim objWSHNet &#039;Windows Scripting Host Network Object <BR>Dim objPrinter &#039;Printer Object to stream text to <BR><BR>strPrinterPath = "\MYServerMyPrinter" <BR>strMessage = inputbox("Enter String to print", "Printer") <BR><BR><BR>Set objWSHNet = CreateObject("WScript.Network") <BR>objWSHNet.AddPrinterConnection "LPT1", strPrinterPath, False <BR><BR><BR>Set objFS = CreateObject("Scripting.FileSystemObject") <BR>Set objPrinter = objFS.CreateTextFile("LPT1:", True) <BR>objPrinter.Write(strMessage) <BR>objPrinter.Close <BR><BR><BR>objWSHNet.RemovePrinterConnection "LPT1:" <BR><BR>Set objWSHNet = Nothing <BR>Set objFS = Nothing <BR>Set objPrinter = Nothing

  2. #2
    Join Date
    Dec 1969

    Default Crosspost from ASP Q&A <eop>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts