+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Dec 2009
    Location
    Katy, Texas
    Posts
    1

    Default Turning a layer on using VBA

    Registered forum members do not see this ad.

    I have searched thru most of the posts, but can't seem to find what I need. I have a command button on a form, and I would like to turn a layer on depending on a selected option button that is also on the form. I'm using AutoCAD 2008.

    Thanks in advance!

    Rick

  2. #2
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,687

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by RickB View Post
    I have searched thru most of the posts, but can't seem to find what I need. I have a command button on a form, and I would like to turn a layer on depending on a selected option button that is also on the form. I'm using AutoCAD 2008.

    Thanks in advance!

    Rick
    Try something like this:
    Code:
    dim oLayer As AcadLayer
    dim lrName as string
    lrName = "MyLayerName"
    Set oLayer = ThisDrawing.Layers.Item(lrName)
    If Not ThisDrawing.ActiveLayer.Handle = oLayer.Handle Then
    oLayer.LayerOn = True
    Else
    Msgbox "layer is already on"
    End if
    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

Similar Threads

  1. Layers turning themselves off
    By Sye1982 in forum AutoCAD Drawing Management & Output
    Replies: 8
    Last Post: 21st Sep 2009, 04:14 pm
  2. Help turning 3d array into dxf
    By stdjpd21 in forum Autodesk Inventor
    Replies: 16
    Last Post: 21st Aug 2009, 07:39 pm
  3. Turning Off A Layer
    By SAM_R in forum AutoCAD General
    Replies: 11
    Last Post: 18th Dec 2008, 05:02 pm
  4. Turning off colours
    By ldavison10 in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 18th Jan 2008, 12:33 am
  5. AutoCAD Map keeps turning into LDD???!!!
    By Beth R in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 30th Jan 2006, 03:43 am

Bookmarks

Posting Permissions

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