Results 1 to 5 of 5

Thread: DefType Statements in VBA

  1. #1
    Member Transformer's Avatar
    Join Date
    Mar 2012
    Posts
    91
    Rep Power
    13

    Lightbulb DefType Statements in VBA

    UsefulGyaan Has Posted the Following On 06-06-2013 05:18 PM:

    The syntax for declaring a variable in VBA is: ****** Dim [VariableName]**** As [VariableType] If the variable type is not specified, then the variable becomes a Variant by default. However, this behavior can be modified using DefType statements. A DefType statement can be used to set the default data type for those Variables/Functions(return type)/Function-Parameters whose […]





    DefType Statements in VBA

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Senior Member
    Join Date
    Jun 2012
    Posts
    337
    Rep Power
    13
    @Excel Fox,

    You referred to the (rather pretentious named) 'Better Solutions' website.
    Using Deftype is being commented as 'This is not good prograaming practice and using these statements should be avoided.' (typo unaltered)
    No arguments were provided. That is what I call 'not good communication practice'.
    I wish that site should concentrate on 'Better arguments'.

  4. #4
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    snb, I tend to agree with you. Personally, if given an option, I would also like to stick to the more orthodox way of programming, and I don't vouch for using Deftype. Having said that, it might be an interesting method, as I haven't come across any microsoft sites that against this either. So I'll take a neutral stand on this. I thought Transformer shared something that was a learning for me, so I thought it's better to give viewers inputs from a few other sites also.

    Having said that, if you do have any evidence, personal or otherwise, that may lead one to believe that Deftype is faulty, I'd be interested.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  5. #5
    Senior Member
    Join Date
    Jun 2012
    Posts
    337
    Rep Power
    13
    @Excel Fox

    I have no evidence whatsoever. Personally I have the impression that the mention of 'good practice' is seldom accompanied by 'sound argumentation'.

Posting Permissions

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