See the top rated post in this thread. Click here

Results 1 to 4 of 4

Thread: Intellisense not recognizing properties

  1. #1
    Member
    Join Date
    2002-07
    Posts
    6
    Login to Give a bone
    1

    Default RE: VBA to contain hidden commands

    Quote Originally Posted by Ed Jobe
    I'm not sure what you mean by "hidden commands". No acad commands are exposed to vba. You have to use the SendCommand method to execute them.
    I'm sorry I should have been a little more clear, VBA contains certain "hidden commands" that do not show up in the object browser and unless you are familiar with it you wouldn't be able to locate them. The commands still work if you type the proper spelling in and are still recognized by VBA. There are a bunch of them but color is one that comes to mind. (I don't program full time, so I don't get a lot of chance to brush up on my skills very often due to being very busy at work).

    Public Function CreateLayer1(LayerName As String, iColor As Integer)

    Dim oLayer As AcadLayer
    Set oLayer = ThisDrawing.Layers.Add(LayerName)
    oLayer.color = iColor

    End Function

    In this example when you type "oLayer.c " you would expect that the object browser would pop up with a sample of all the c list however color does not pop up. I know there are more commands like this even though I fail to remember which they are at the moment. I Would just like AutoCad/VBA to fix these little hidden commands so that the object browser would work properly. Sorry again for any confusion.

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,409
    Login to Give a bone
    1

    Default Re: Intellisense not recognizing properties

    That helps explain some of the confusion, the terminology you used. First Color is a property, not a "command". Second, what you describe is called Intellisense, not the object browser. That is accessed from the View menu, or F2. Although, Intellisense gets its info the same way as I mentioned before, it is context sensitive, whereas the Object Browser is not. If you are having problems with Intellisense not properly recognizing objects, it is likely that you have created a variable somewhere in your project that uses the same name and is confusing Intellisense. Notice that Intellisense did not correct the case either, i.e. you still have "color", not "Color". VBA can help you guard against problems with variables if you use Option Explicit in all your modules. This forces you to explicitly declare all variables. Without Option Explicit, you can simply type in some text and vba will declare it as type Variant for you. The trouble is, you may not realize you did this. It could simply be a typo, and now you have an extra variable. Try this, search all modules for "color" and see if you can find the problem. The problem is not with Intellisense or missing info. Its something with your environment. HTH
    C:> ED WORKING....


    LinkedIn

  3. #3
    Member
    Join Date
    2002-07
    Posts
    6
    Login to Give a bone
    0

    Default Re: Intellisense not recognizing properties

    Quote Originally Posted by Ed Jobe
    it is likely that you have created a variable somewhere in your project that uses the same name and is confusing Intellisense.
    Intellisense is what I should have named it, sorry I am not up on all the proper lingo. I always use option explicit and the problem isn't with me having declared a variable that could confuse it, in this case intellisense just doesn't work in this case (and others). I am basically self taught but I did take a 3 day course last year and even my teacher there mentioned that intellisense works only 99% of the time. I just think VBA just needs a little revamping. Thanks for your reply.
    Last edited by Mike.Perry; 2006-08-09 at 04:16 AM. Reason: [QUOTE] tags fixed.

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,409
    Login to Give a bone
    0

    Default Re: Intellisense not recognizing properties

    Your reply seemed a little defensive...hope not, just trying to help you id the problem.
    Quote Originally Posted by otis1999
    even my teacher there mentioned that intellisense works only 99% of the time. I just think VBA just needs a little revamping. Thanks for your reply.
    While there may be some truth to that (nothing's perfect), there are usually reasons why. But the things you mention seem to be way more than 1%. For example, I pasted your example into my module and Intellisense immediately capitalized "color". So the problem definitely is on your end, not vba's. The troubleshooting technique I gave you is from experience. Some things you learn the hard way. With one module, I never could find the source of the problem. I just copied the code to a new module and it cleared it up.
    C:> ED WORKING....


    LinkedIn

Similar Threads

  1. Intellisense Shortcuts?
    By jasperw in forum Revit Architecture - General
    Replies: 1
    Last Post: 2010-06-07, 02:45 PM
  2. Lisp not recognizing last entity... I think?
    By stevenw00 in forum AutoLISP
    Replies: 4
    Last Post: 2009-08-07, 12:03 AM
  3. Intellisense died
    By MikeJarosz in forum Revit - API
    Replies: 2
    Last Post: 2007-05-01, 09:56 PM

Posting Permissions

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