Consulting

Results 1 to 7 of 7

Thread: Acad2002: make a layout current

  1. #1
    VBAX Regular Sandieslover's Avatar
    Joined
    Sep 2004
    Location
    Netherlands
    Posts
    14
    Location

    Acad2002: make a layout current

    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
    [VBA]ThisDrawing.ActiveLayout = "LayoutA4"[/VBA]
    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

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    A layout is a tabbed layout I think...not a print layout
    post the rest of your code please.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Regular Sandieslover's Avatar
    Joined
    Sep 2004
    Location
    Netherlands
    Posts
    14
    Location
    Actualy there isn't much more...
    [VBA]Sub LayoutA4Current()
    ThisDrawing.Layouts.Item("Layout1").Delete
    ThisDrawing.ActiveLayout = "LayoutA4"
    End Sub
    [/VBA]
    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

  4. #4
    VBAX Regular Sandieslover's Avatar
    Joined
    Sep 2004
    Location
    Netherlands
    Posts
    14
    Location
    Hi Lucas,
    in addition, this is what acad help says:
    To add a new Layout to the collection, use the Add method. When a new layout is created, it is not automatically made current. To make a layout current, use the ActiveLayout property.
    When clicking on the ActiveLayout link, I'm lost.

  5. #5
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Hi SandieSlover and Welcome

    Give this a try:

    [vba]
    Sub Test()
    ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item("LayoutA4")
    End Sub
    [/vba]

    Worked for me (but I'm using ACAD 2004)




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  6. #6
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Worked for me too. I also am running 2004
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  7. #7
    VBAX Regular Sandieslover's Avatar
    Joined
    Sep 2004
    Location
    Netherlands
    Posts
    14
    Location

    [Solved] Acad2002: make a layout current

    Thanx guys!
    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.

    Thanx for your time and efforts,

    Kind regards,
    Sandieslover

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •