;; The following code change the default modelspace printer
;; for all the drawings in the path "H:\" to "DWF6 ePlot.pc3"
;; Author: Unknown- Option Explicit
- Sub BatchChangePrinter()
- Dim files() As String
- Dim file_name As String
- Dim dir_path As String
- Dim num_files, a As Long
- dir_path = "H:\*.dwg"
- file_name = Dir$(dir_path)
- Do While Len(file_name) > 0
- If Not (file_name = ".") Or (file_name = "..") Then
- num_files = num_files + 1
- ReDim Preserve files(1 To num_files)
- files(num_files) = Left(dir_path, Len(dir_path) - 5) & file_name
- End If
- file_name = Dir$()
- Loop
- For a = LBound(files) To UBound(files)
- Dim doc As AcadDocument
- Dim model As AcadLayout
- Set doc = ThisDrawing.Application.Documents.Open(files(a))
- Set model = doc.Layouts("Model")
- model.RefreshPlotDeviceInfo
- model.ConfigName = "DWF6 ePlot.pc3"
- doc.Close (True)
- Next
- End Sub
|