Alan.Shi 发表于 2010-5-11 10:40:00

[求助]怎样用VBA打印问题

大家好,我想要VBA打印一批图纸成PDF,而且全是在布局空间的,有的图纸有一个布局空间,有些是有两个或者更多,而且打印出来的PDF文档要和DWG文件名是一样的,问题是我要使用范围打印,和打印样式,不知道如何设置

Alan.Shi 发表于 2010-5-12 19:18:00

<p>怎么都没人帮我看看啊,我找了些然后加工了下,不知道为什么打印样式怎么也用不上,请大侠们帮我看看哪出了问题啊</p><p>Public Sub SetPlotConfiguration()<br/>&nbsp;&nbsp;&nbsp; objPlotConfiguration.ConfigName = "PDFCreator"<br/>&nbsp;&nbsp;&nbsp; objPlotConfiguration.StyleSheet = "My.ctb"<br/>&nbsp;&nbsp;&nbsp; objPlotConfiguration.CanonicalMediaName = "A3"<br/>&nbsp;&nbsp;&nbsp; objPlotConfiguration.StandardScale = acScaleToFit<br/>&nbsp;&nbsp;&nbsp; objPlotConfiguration.CenterPlot = True<br/>&nbsp;&nbsp;&nbsp; objPlotConfiguration.PlotWithPlotStyles = True<br/>&nbsp;&nbsp;&nbsp; objPlotConfiguration.PlotWithLineweights = False<br/>&nbsp;&nbsp;&nbsp; objPlotConfiguration.PlotHidden = False<br/>&nbsp;&nbsp;&nbsp; objPlotConfiguration.PlotType = acExtents<br/>&nbsp;&nbsp;&nbsp; objPlot.NumberOfCopies = 1<br/>&nbsp;&nbsp;&nbsp; objPlot.QuietErrorMode = True<br/>End Sub</p>

Alan.Shi 发表于 2010-5-14 15:00:00

<p>现在改成这样的了,但是还是不行啊,请哪位高人帮我看下</p><p>Sub plotpdf()<br/>&nbsp;&nbsp;&nbsp; Dim Plotset As AcadPlotConfiguration<br/>&nbsp;&nbsp;&nbsp; Set Plotset = ThisDrawing.PlotConfigurations.Add("pdf")<br/>&nbsp;&nbsp;&nbsp; Plotset.ConfigName = "ComputerPrint"<br/>&nbsp;&nbsp;&nbsp; Plotset.StyleSheet = "Fab Dwg.ctb"<br/>&nbsp;&nbsp;&nbsp; Plotset.CanonicalMediaName = "A3"<br/>&nbsp;&nbsp;&nbsp; Plotset.PlotWithPlotStyles = True<br/>&nbsp;&nbsp;&nbsp; Plotset.PlotRotation = ac90degrees<br/>&nbsp;&nbsp;&nbsp; Plotset.ShowPlotStyles = True<br/>&nbsp;&nbsp;&nbsp; Plotset.PaperUnits = acMillimeters<br/>&nbsp;&nbsp;&nbsp; Plotset.PlotType = acExtents<br/>&nbsp;&nbsp;&nbsp; Plotset.StandardScale = acScaleToFit<br/>&nbsp;&nbsp;&nbsp; Plotset.CenterPlot = True<br/>&nbsp;&nbsp;&nbsp; ThisDrawing.Application.ActiveDocument.plot.PlotToDevice ("ComputerPrint")<br/>End Sub</p>

fjfhgdwfn 发表于 2010-5-14 16:56:00

<p>系统变量BACKGROUNDPLOT现在是不是1了,如果是,</p><p>改成0试试了。用了循环,是要打开后台打印的。</p>

Alan.Shi 发表于 2010-5-14 19:36:00

好像是这个系统变量的问题,我刚才用家里的电脑试了下,条件有限,明天去办公室再试一下,非常感谢<strong><font color="#61b713" face="Verdana">楼上的。</font></strong>

Alan.Shi 发表于 2010-5-19 22:54:00

想再请教下,现在的语句是不是可以理解为:只是添加了“pdf”这个打印配置,但它并不是默认的打印配置,然而通过最后一句只是按照当前默认的打印配置打印出来的,如果是的话,我怎样才能把“pdf”设置为默认的呢?
页: [1]
查看完整版本: [求助]怎样用VBA打印问题