View Full Version : Acad2002: make a layout current
Sandieslover
06-20-2006, 11:54 PM
Hi guys,
my selfconfidence sunk below zero, 'cause I'm not able to activate a different layout in VBA.
The help file points to the code "ActiveLayout" but I can't make it work.
I use the code
ThisDrawing.ActiveLayout = "LayoutA4"
But get an Compile error, Type mismatch
And yes... there is a layout called LayoutA4
Please, can someone help me out?
Thx in advance,
Sandieslover
lucas
06-21-2006, 07:08 AM
A layout is a tabbed layout I think...not a print layout
post the rest of your code please.
Sandieslover
06-21-2006, 10:27 PM
Actualy there isn't much more...
Sub LayoutA4Current()
ThisDrawing.Layouts.Item("Layout1").Delete
ThisDrawing.ActiveLayout = "LayoutA4"
End Sub
It deletes the default layout called "Layout1" (This does work),
but making the other one current is a bit of a problem, although the help file points in this direction.
Kind regards,
Sandieslover
Sandieslover
06-21-2006, 10:46 PM
Hi Lucas,
in addition, this is what acad help says:
To add a new Layout to the collection, use the Add (mk:@MSITStore:C:\Program%20Files\AutoCAD%202002\help\acadauto.chm::/idh_add.htm) method. When a new layout is created, it is not automatically made current. To make a layout current, use the ActiveLayout (mk:@MSITStore:C:\Program%20Files\AutoCAD%202002\help\acadauto.chm::/idh_activelayout.htm) property.
When clicking on the ActiveLayout link, I'm lost.
malik641
06-23-2006, 05:56 AM
Hi SandieSlover and Welcome :hi:
Give this a try:
Sub Test()
ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item("LayoutA4")
End Sub
Worked for me (but I'm using ACAD 2004) :thumb
lucas
06-23-2006, 06:03 AM
Worked for me too. I also am running 2004
Sandieslover
06-25-2006, 11:23 PM
Thanx guys!:beerchug:
This works like a charm for me too.
As the help file only pointed me into the direction of the "activelayout" command, the nearest example I could find was the "Make a layer current" and this piece of code just used the layername.
Translating this to my layout problem I only thought of the layout name, instead of the whole Thisdrawing..... code.:banghead:
Thanx for your time and efforts,
Kind regards,
Sandieslover
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.