Does anyone have experience with selecting paper size using C#? There is a great macro on Codestack (here) but it uses a VBA function “Device Capabilities” that, according to me reading, does not exist in C#.
Thanks,
Jordan
Does anyone have experience with selecting paper size using C#? There is a great macro on Codestack (here) but it uses a VBA function “Device Capabilities” that, according to me reading, does not exist in C#.
Thanks,
Jordan
I know it’s not a ton of help, since it’s not directly in c#, but you should be able to translate it pretty easily.
The below code picks A (8.5" x 11") and B(11" x 17")
With swModel.PageSetup
Select Case PaperSize
Case "A"
.PrinterPaperSize = 1
.ScaleToFit = True
swPSize = 1
Case "B"
.PrinterPaperSize = 17
swPSize = 17
.ScaleToFit = True
Case Else
MsgBox("Error! You must select a page size before printing!")
Exit Sub
End Select
End With
This may also help if you haven’t looked at it yet.
API Help Page - PageSetup Example c#
This
Stack Overflow post may help.