Exchange Forum > ActiveX and VBA
Changing the active Layout
Changing the active Layout

#1

Tomoko
Join Date:
08-08-2007
I'm trying to find out how to change the active Layout in VBA.
I want to do the same commands on each Layout.
So far it only works on the current Layout tab.
 
Changing the active Layout

#2

V Chan
Join Date:
07-30-2007
The basic concept is:
Code:
Sub ChgLayout()
  Dim NextLayout As String
  NextLayout = "Layout2"
  ThisDrawing.ActiveLayout = ThisDrawing.Layouts(NextLayout)
End Sub
Changing the active Layout

#3

ML0940
Join Date:
12-14-2007
Hey Tom
 
You can loop through the entire collection of layouts and if necessary, exclude Model
 
If would be something like this;
This is pseudo code
 
For Each layout in Thisdrawing.layouts
If Not Modelspace Then
'You would put your code here
End if
Next layout
 
This way, you can address each layout in the entire drawing at once.
 
So, it will loop through, find the first layout and apply your code
Next layout and so on.
 
If you need further help or would like me to help you write the precise code out, then give me a shout
 
M