Excel is nuts and acts nutty

Robert Baer <[email protected]> Sun, 3 Oct 2021 23:04:58 -0700
Newsgroups alt.computer
Organization theCubeNet - www.thecubenet.com
Message-ID <[email protected]>
  On tips.net, i see:

  On Bob's system, Excel refuses to print to any printer other than the 
one set as the default for the system. This only happens in Excel, not 
in Word or any other installed application. So in order to print he has 
to temporarily change the default printer to the one he wants, print, 
and then remember to set the printer back afterwards.

   I have seen this and printing variants between versions of Excel that 
is "constant" in OSes from Win2K thru Win7.

   One can easily get scrambled, long output.
   The "demo" program below demonstrates that; a minor variation will 
indicate printing on Ne00:.

Sub Prynt()
'
' prynt Macro
' Macro recorded 10/3/2021 by ROBERT BAER

     pPath = "W:\OIL4LESS\ANALOG\HVREG\Boards\TITANTWO\TT_C\RevH\"


' *** NOTE: default printer absolutely MUST be the one you want to use ***
'     Printer properties PORTS MUST be set properly also.

' In "modern" defective Excel, trys to print to default; if program 
attempts otherwise,
'  output file has proper name, but contents are scrambled, SO must set 
default to what is needed.

    sPrinter = "Acrobat PDFWriter on FILE:"      'this printer does not 
exist on this system
    ActiveWindow.SelectedSheets.PrintOut ActivePrinter:=sPrinter, _
        Copies:=1, PrintToFile:=True, PrToFileName:=pPath + 
"PrintedCase1.PDF"
' Message is "Now printing page 1 of 1 'TestLPT.xls' on the Canon MP 280 
series Printer on Ne03:"
' Note: Canon MP 280 series Printer is set to default and driven via 
USB002. System ASS-u-MEs file,
'       so scrambles content.

    sPrinter = "Canon MP280 series Printer"      'this printer does 
exist, works via USB port EXCEPT here
    ActiveWindow.SelectedSheets.PrintOut ActivePrinter:=sPrinter, _
        Copies:=1, PrintToFile:=True, PrToFileName:=pPath + 
"PrintedCase2.PDF"
' Message is "Now printing page 1 of 1 'TestLPT.xls' on the Canon MP 280 
series Printer on Ne03:"
' Note: ditto.

    sPrinter = "Xerox Phaser 6120 PS"   'this printer exists on this system
    ActiveWindow.SelectedSheets.PrintOut ActivePrinter:=sPrinter, _
        Copies:=1, PrintToFile:=True, PrToFileName:=pPath + 
"PrintedCase3.PDF"
' Message is "Now printing page 1 of 1 'TestLPT.xls' on the Xerox Phaser 
6120 PS on FILE"
' Note: Printer assignment must be set to FILE to work properly, else 
get scrambled content.
' Note: ActivePrinter = "Xerox Phaser 6120 PS on FILE:"

Close


End Sub




-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus