zezh 发表于 2009-12-3 07:57:00

[求助]请高手分析:用VBA打印这个文件,打印的不是设好窗口的范围

问题同上,代码如下。打印机选成你的机子上有的打印机,大家可试试。用同样的代码打印别的文件没问题。请高手分析原因。
Public Sub test()
    Dim pLayout As AcadLayout
    Dim minPnt(1) As Double
    Dim maxPnt(1) As Double
   
    Set pLayout = ThisDrawing.ActiveLayout
   
    minPnt(0) = 0: minPnt(1) = 0
    maxPnt(0) = 200: maxPnt(1) = 100
    pLayout.SetWindowToPlot minPnt, maxPnt
    pLayout.PlotType = acWindow
   
    ThisDrawing.Plot.DisplayPlotPreview acFullPreview
End Sub
**** Hidden Message *****

zezh 发表于 2010-8-12 08:54:00

请大家试试,很奇怪,分析一下原因。

zhejiang000 发表于 2010-10-19 15:13:00

Public Sub test()
    Dim pLayout As AcadLayout
    Dim minPnt(2) As Double
    Dim maxPnt(2) As Double
   
    Set pLayout = ThisDrawing.ActiveLayout
   
    minPnt(0) = 0: minPnt(1) = 0
    maxPnt(0) = 200: maxPnt(1) = 100



    Dim min_Pnt, max_Pnt As Variant
    min_Pnt = ThisDrawing.Utility.TranslateCoordinates(minPnt, 0, 3, False)
    max_Pnt = ThisDrawing.Utility.TranslateCoordinates(maxPnt, 0, 3, False)
    ReDim Preserve min_Pnt(0 To 1)
    ReDim Preserve max_Pnt(0 To 1)



    pLayout.SetWindowToPlot min_Pnt, max_Pnt
    pLayout.PlotType = acWindow
   
    ThisDrawing.Plot.DisplayPlotPreview acFullPreview
End Sub
页: [1]
查看完整版本: [求助]请高手分析:用VBA打印这个文件,打印的不是设好窗口的范围