Public Sub printdoc() Dim point1(100) As Variant Dim point2 As Variant, point3 As Variant, point4(0 To 1) As Variant Dim keywordList As String On Error Resume Next With ThisDrawing.ActiveLayout .StyleSheet = "monochrome.ctb" .CenterPlot = True .PlotRotation = ac90degrees .PaperUnits = acMillimeters .CanonicalMediaName = "A4" .ConfigName = "HP LaserJet 5100 Series" End With point2 = ThisDrawing.Utility.GetPoint(, vbLf & "请点击打印区域的左下角:") i = 0 Do While i < 1 point1(i) = point2 If Err.Number = -2147352567 Or Err.Number = 13 Then Exit Sub End If point2 = ThisDrawing.Utility.GetPoint(, vbLf & "请点击打印区域的右上角:") If (Int(point1(i)(1)) <> Int(point2(1))) Then i = i + 1 point1(i) = point2 End If Loop Number = ThisDrawing.Utility.GetInteger("Enter an number of the pages: ") point2 = point1(0) point3 = point1(1) ReDim Preserve point2(0 To 1) ReDim Preserve point3(0 To 1) For j = 0 To Number - 1 point2(0) = point2(0) + (point3(0) - point2(0)) * j point3(0) = point3(0) + (point3(0) - point2(0)) * j ThisDrawing.ActiveLayout.CenterPlot = True ThisDrawing.ActiveLayout.SetWindowToPlot point2, point3 ThisDrawing.Plot.NumberOfCopies = 1 ThisDrawing.ActiveLayout.PlotType = acWindow ThisDrawing.Plot.DisplayPlotPreview acFullPreview Next j End Sub
为什么不能居中打印,还要设什么? |