вот решение на основе Эта ссылка
ActiveSheet.ComboBox1.List = GetPaperSizes
, где GetPaperSizes
- это следующая функция, которую вы должны поместить в стандартный модуль:
Option Explicit
'Written: June 14, 2010
'Author: Leith Ross
'Summary: Lists the supported paper sizes for the default printer in a message box.
Private Const DC_PAPERNAMES = &H10
Private Declare Function DeviceCapabilities _
Lib "winspool.drv" _
Alias "DeviceCapabilitiesA" _
(ByVal lpDeviceName As String, _
ByVal lpPort As String, _
ByVal iIndex As Long, _
ByRef lpOutput As Any, _
ByRef lpDevMode As Any) _
As Long
Private Declare Function StrLen _
Lib "kernel32.dll" _
Alias "lstrlenA" _
(ByVal lpString As String) _
As Long
Function GetPaperSizes() As Variant
Dim AllNames As String
Dim I As Long
Dim Msg As String
Dim PD As Variant
Dim Ret As Long
Dim papersizes() As Byte
Dim PaperSize As String
'Retrieve the number of available paper names
PD = Split(Application.ActivePrinter, " on ")'<<<== change "on" with its local Language translation from english
Ret = DeviceCapabilities(PD(0), PD(1), DC_PAPERNAMES, ByVal 0&, ByVal 0&)
'resize the array
ReDim papersizes(0 To Ret * 64) As Byte
'retrieve all the available paper names
Call DeviceCapabilities(PD(0), PD(1), DC_PAPERNAMES, papersizes(0), ByVal 0&)
'convert the retrieved byte array to an ANSI string
AllNames = StrConv(papersizes, vbUnicode)
'loop through the string and search for the names of the papers
For I = 1 To Len(AllNames) Step 64
PaperSize = Mid(AllNames, I, 64)
PaperSize = Left(PaperSize, StrLen(PaperSize))
If PaperSize <> vbNullString Then Msg = Msg & PaperSize & vbCrLf
Next I
GetPaperSizes = Split(Left(Msg, Len(Msg) - 2), vbCrLf)
End Function