24.10.2012, 19:53
Es tut mir Leid, dass ich dieses Thema noch mal aufwärmen muss,
aber ich habe Mist gebaut.
Ich habe versehentlich unfertigen Code ins Forum gestellt.
Hier nun das fertige Makro zur Ebenensteuerung.
falls jemand das Makro aus dem letzten Beitrag benutzt, tausche es bitte gegen dieses aus.
ich bitte um Entschuldigung,
koter
aber ich habe Mist gebaut.
Ich habe versehentlich unfertigen Code ins Forum gestellt.
Hier nun das fertige Makro zur Ebenensteuerung.
falls jemand das Makro aus dem letzten Beitrag benutzt, tausche es bitte gegen dieses aus.
Code:
(ThisMacroStorage)
Dim DocEv As New Ereignisfang
Private Sub GlobalMacroStorage_WindowActivate(ByVal Doc As Document, ByVal Window As Window)
Set DocEv.x = Nothing
Set DocEv.x = Application.ActiveDocument
End Sub
Sub SichtbarDruckbar(LName)
lns = Split(LName, " ")
HAnfang = lns(0)
For Each l In ActivePage.Layers
If Right(l.Name, 5) <> "Haupt" Then
lns = Split(l.Name, " ")
LAnfang = lns(0)
If HAnfang = LAnfang Then
ActivePage.Layers(l.Name).Printable = _
ActivePage.Layers(LName).Printable
ActivePage.Layers(l.Name).Visible = _
ActivePage.Layers(LName).Visible
ActivePage.Layers(l.Name).Editable = _
ActivePage.Layers(LName).Editable
End If
End If
Next
Set DocEv.x = Nothing
Set DocEv.x = Application.ActiveDocument
End Sub
Sub Hauptebene(LName As String)
Set DocEv.x = Nothing
vi = ActivePage.AllLayers(LName).Visible
ed = ActivePage.AllLayers(LName).Editable
pr = ActivePage.AllLayers(LName).Printable
For Each p In ActiveDocument.Pages
For Each l In p.Layers
lns = Split(l.Name, " ")
If lns(0) = LName Then
l.Visible = vi
l.Editable = ed
l.Printable = pr
End If
Next
Next
Set DocEv.x = Application.ActiveDocument
End Sub
(Klassenmodul: Ereignisfang)
Public WithEvents x As Document
Private Sub x_LayerChange(ByVal Layer As Layer)
If Layer.Master = True Then
Call ThisMacroStorage.Hauptebene(Layer.Name)
ElseIf Right(Layer.Name, 5) = "Haupt" Then
Call ThisMacroStorage.SichtbarDruckbar(Layer.Name)
End If
End Sub
ich bitte um Entschuldigung,
koter