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

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

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

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

<p><font face="Verdana">Public Sub test()<br/>&nbsp;&nbsp;&nbsp; Dim pLayout As AcadLayout<br/>&nbsp;&nbsp;&nbsp; Dim minPnt(2) As Double<br/>&nbsp;&nbsp;&nbsp; Dim maxPnt(2) As Double<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; Set pLayout = ThisDrawing.ActiveLayout<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; minPnt(0) = 0: minPnt(1) = 0<br/>&nbsp;&nbsp;&nbsp; maxPnt(0) = 200: maxPnt(1) = 100</font></p>
<p><font face="Verdana"></font>&nbsp;</p>
<p><font face="Verdana">&nbsp;</p>
<p><br/></font><font face="Verdana">&nbsp;&nbsp;&nbsp; Dim min_Pnt, max_Pnt As Variant<br/>&nbsp;&nbsp;&nbsp; min_Pnt = ThisDrawing.Utility.TranslateCoordinates(minPnt, 0, 3, False)<br/>&nbsp;&nbsp;&nbsp; max_Pnt = ThisDrawing.Utility.TranslateCoordinates(maxPnt, 0, 3, False)<br/>&nbsp;&nbsp;&nbsp; ReDim Preserve min_Pnt(0 To 1)<br/>&nbsp;&nbsp;&nbsp; ReDim Preserve max_Pnt(0 To 1)</font></p>
<p><font face="Verdana"></font>&nbsp;</p>
<p><font face="Verdana">&nbsp;</p>
<p><br/>&nbsp;&nbsp;&nbsp; pLayout.SetWindowToPlot min_Pnt, max_Pnt<br/>&nbsp;&nbsp;&nbsp; pLayout.PlotType = acWindow<br/>&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp; ThisDrawing.Plot.DisplayPlotPreview acFullPreview<br/>End Sub<br/></p></font>

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

<p>请大家试试,很奇怪,分析一下原因。</p>
页: [1]
查看完整版本: [求助]请高手分析:用VBA打印这个文件,打印的不是设好窗口的范围