Hy, it's me again !
Just a part of the code :
Code:
Dim objPresentation As AcadLayout
Dim objPlotDevices As Variant
Dim x As Integer
Dim TestPresentationResultat As Integer
Dim strobjPlotDevices As String, strpos As Variant, strtemp As String
Dim strobjPresConfName As Variant
Set objPresentation = ThisDrawing.PaperSpace.layout
' Collection des "Layouts" (Présentations) du dessin courant
' et liste les infos de base.
Dim Layouts As AcadLayouts
' Get layouts collection from document object
Set Layouts = ThisDrawing.Layouts
' Rafraichis les informations des imprimantes
objPresentation.RefreshPlotDeviceInfo
objPlotDevices = objPresentation.GetPlotDeviceNames()
If Left(ThisDrawing.Name, 6) <> "Dessin" Then
For Each objPresentation In ThisDrawing.Layouts
If UCase(objPresentation.Name) <> UCase("Model") Then
TestPresentationResultat = 0
For x = LBound(objPlotDevices) To UBound(objPlotDevices)
If InStr(objPlotDevices(x), "\") > 0 Then
intPos = InStrRev(objPlotDevices(x), "\") + 1
strtemp = Mid$(objPlotDevices(x), intPos)
strobjPlotDevices = strtemp
Else
' Invalid path submitted so return 0.
strobjPlotDevices = objPlotDevices(x)
End If
If InStr(objPresentation.ConfigName, "\") > 0 Then
intPos = InStrRev(objPresentation.ConfigName, "\") + 1
strtemp = Mid$(objPresentation.ConfigName, intPos)
strobjPresConfName = strtemp
Else
' Invalid path submitted so return 0.
strobjPresConfName = objPresentation.ConfigName
End If
If strobjPlotDevices = strobjPresConfName Then
' Configuration connue !
TestPresentationResultat = 1
End If
Next
' Remplace l'ancien traceur "PDF995" avec ou sans extension
If TestPresentationResultat = 0 And _
(UCase(strobjPresConfName) = "PDF995" Or UCase(strobjPresConfName) = "PDF995.PC3") Then
objPresentation.ConfigName = "TraceurLyon1.pc3"
objPresentation.CanonicalMediaName = "User257"
objPresentation.SetCustomScale 1, 1
objPresentation.PlotRotation = ac90degrees
objPresentation.PaperUnits = acMillimeters
TestPresentationResultat = 1
End If
' Remplace le traceur Toulouse "REPROCOLOR" avec ou sans extension
If TestPresentationResultat = 0 And _
(UCase(strobjPresConfName) = "REPROCOLOR" Or UCase(strobjPresConfName) = "REPROCOLOR.PC3") Then
objPresentation.ConfigName = "TraceurLyon1.pc3"
objPresentation.CanonicalMediaName = "User257"
TestPresentationResultat = 1
End If
If TestPresentationResultat = 0 Then
MsgBox "Il n'y a pas d'imprimante pour cette présentation : " & _
objPresentation.Name
End If
End If
Next
End If
End Sub
[ Moderator Action = ON ] What are [ CODE ] tags... [ Moderator Action = OFF ]