Consulting

Results 1 to 5 of 5

Thread: Application object names, true, false etc

  1. #1
    VBAX Tutor
    Joined
    Mar 2010
    Posts
    287
    Location

    Question Application object names, true, false etc

    When working with object names, properties, logical statement you sometimes need to check the returned value (or a string).

    When moving between different version of Excel (English, German, French) this can change e.g.

    Class becomes Klasse
    True becomes Wahr
    False becomes Falsh
    Worksheet becomes Werkblad
    Workbook becomes Werkboek

    Is there a way to get the application name for an object, property or type ? e.g.

    Application True = "Wahr"
    Application Workbook = "Werkboek"

    This would allow me to use application default named instead of hard coding references. Real world example :

    If vc.Type = 100 Then c00 = IIf(vc.Properties.Count = 66, "werkblad", "werkboek")

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    TypeName might help a little

    Returns a String that provides information about a variable.
    Syntax
    TypeName(varname)
    The required varname argument is a Variant containing any variable except a variable of a user-defined type.
    I don't know how 'International' it is (no way to test), but may be it returns the 'local' name.

    Even if it always returns the 'English' name you might be able to program around that

    Good luck

    Paul

  3. #3
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    This is not usually an issue in VBA. True is True as far as VBA is concerned unless you coerce it to a string before testing and I don't know why you would do that?
    Be as you wish to seem

  4. #4
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    In VBA retruned values are always in American English.

    The code you showed is meant to return a language specific string; not a result of any VBA code/property/value.

  5. #5
    VBAX Tutor
    Joined
    Mar 2010
    Posts
    287
    Location
    Thanks snb. I am looking through that tool you uploaded on the seperate thread about building a call tree.

    I am updating it to English, and I have several other projects with similar issues. So thought I would ask about international settings and detecting names of objects.

Posting Permissions

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