printing from Excel VBA
Posted: Thu Feb 26, 2015 7:35 pm
L.S.,
I get an error when trying to peint a (part) of a sheet (=printarea)
[quote]
C:\Ketel\offertes\2015\TEST\offerte 2015004 naam.pdf
Error trapped by OnError eventhandler.
Error= 438
Description= Property or method not supported by this object object
Source=Offerte_Factuur
Last: 0
Help: 1000438
[/quote]
Settings:
With oPrinterSettings
.SetValue "Output", sFolder & sFileName
.SetValue "ShowSettings", "never"
.SetValue "ShowPDF", "yes"
.SetValue "WriteSettings", "True"
.SetValue "PrintToFile", "true"
.SetValue "ConfirmOverwrite", "no"
.SetValue "ShowProgress", "no"
.SetValue "ShowProgressFinished", "no"
.SetValue "SuppressErrors", "yes"
'.SetValue "EmbedAllFonts", "true"
End With
Debug.Print sFolder & sFileName
Debug.Print ActiveSheet
'Change To PDF printer
sCurrentPrinter = ActivePrinter
'ActivePrinter = sFullPrinterName
'Print the active work sheet
ActiveSheet.PrintOut
The location should be "C:\Ketel\offertes\2015\TEST\" i.e. NOT the Environment data.
The filename could be like "Kopie administratie offerte 2015123 mw Verkerk.pdf"
What is the matter?
Is it not possible to use ordinary Directory names?
Or is the filename maximized?
Looking forward to your help
I get an error when trying to peint a (part) of a sheet (=printarea)
[quote]
C:\Ketel\offertes\2015\TEST\offerte 2015004 naam.pdf
Error trapped by OnError eventhandler.
Error= 438
Description= Property or method not supported by this object object
Source=Offerte_Factuur
Last: 0
Help: 1000438
[/quote]
Settings:
With oPrinterSettings
.SetValue "Output", sFolder & sFileName
.SetValue "ShowSettings", "never"
.SetValue "ShowPDF", "yes"
.SetValue "WriteSettings", "True"
.SetValue "PrintToFile", "true"
.SetValue "ConfirmOverwrite", "no"
.SetValue "ShowProgress", "no"
.SetValue "ShowProgressFinished", "no"
.SetValue "SuppressErrors", "yes"
'.SetValue "EmbedAllFonts", "true"
End With
Debug.Print sFolder & sFileName
Debug.Print ActiveSheet
'Change To PDF printer
sCurrentPrinter = ActivePrinter
'ActivePrinter = sFullPrinterName
'Print the active work sheet
ActiveSheet.PrintOut
The location should be "C:\Ketel\offertes\2015\TEST\" i.e. NOT the Environment data.
The filename could be like "Kopie administratie offerte 2015123 mw Verkerk.pdf"
What is the matter?
Is it not possible to use ordinary Directory names?
Or is the filename maximized?
Looking forward to your help