首先on error resume next,从1到40,逐个给打印机设置papersize,没有错误的为可用的

解决方案 »

  1.   

    印象中,纸张型号可以从PAGESETUPDLG 结构的ptPaperSize获得。具体请查msdn。如果是vb.net就方便了,提供了Printing.PrinterSettings类可以直接取出名称与纸张大小了
      

  2.   

    我是说如何能够获得系统所有PaperSize的集合。
      

  3.   

    感谢您使用微软产品。您可以使用WMI的Win32_Printer对象获得所有打印机支持的纸张大小的信息,如下例:Private Sub Command1_Click()    WQL = "Select * From Win32_Printer"    Set objinst = GetObject("winmgmts:").ExecQuery(WQL)    For Each obj In objinst        Debug.Print obj.Name             Dim type1 As String       For i = 1 To UBound(obj.PaperSizesSupported)                 Debug.Print obj.PaperSizesSupported(i)              Next    NextEnd Sub详细信息请参考:Win32_Printerhttp://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_printer.asp 
    -      微软全球技术中心 VB技术支持本帖子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。======================
      

  4.   

    谢谢acptvb,我正在try,如有问题,我再向您请教。
      

  5.   

    To acptvb:It should use the object PrinterPaperNames not the object PaperSizesSupported to get the PaperNames array.When you run the following code, the Papernames list can be printed out.Option ExplicitPrivate Sub Command1_Click()    Dim WQL As String
        Dim objinst As Object
        Dim obj As Object
        Dim i As Long
        
        
        WQL = "Select * From Win32_Printer"    Set objinst = GetObject("winmgmts:").ExecQuery(WQL)    For Each obj In objinst        Debug.Print obj.Name        Dim type1 As String       For i = 1 To UBound(obj.PrinterPaperNames)            Debug.Print obj.PrinterPaperNames(i)        Next    NextEnd Sub
      

  6.   

    Set comp = GetObject("winmgmts:{impersonationLevel=impersonate}!//yourRemoteMachine").InstancesOf("Win32_ComputerSystem")
    For Each obj In comp
       Debug.Print obj.Name
       Debug.Print obj.DoMain
       Debug.Print obj.SystemType
       Debug.Print obj.Manufacturer
    Next
      

  7.   

    相关文章参考:Microsoft Windows Management Instrumentation: Background and Overview
    http://msdn.microsoft.com/library/en-us/dnwmi/html/msdn_wmiwp.asp?frame=trueManaging Windows with WMI
    http://msdn.microsoft.com/library/en-us/dnwmi/html/mngwmi.asp?frame=trueWindows Management Instrumentation: Administering Windows and Applications across Your Enterprise
    http://msdn.microsoft.com/msdnmag/issues/0500/wmiover/toc.asp?frame=trueWindows Management Instrumentation (Platform SDK for WMI)
    http://msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_start_page.asp?frame=true