1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Using Din in code

Discussion in 'Business Applications' started by mrl, Nov 14, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. mrl

    mrl Thread Starter

    Joined:
    Aug 12, 2007
    Messages:
    340
    Hi
    What is the reason to use Din in code? I'm still learning to write macros and can do it easier with out using Din.
    When I run it, I can't see a difference

    Mike
     
  2. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Are you sure you do not mean Dim? You should always declare your variables.
     
  3. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    If you mean Dim as Rockn suggets it comes from the original BASIC language and was used not only to "declare" variables but also allocate Memory space for them. In those days memory was at a premium, so it was essential for the Basic Editor to have an idea of how much memory to set aside to prevent the program from running out of memory and crashing.
    Today it's main use is to tell the VB Editor what Type of variable you are going to use, this has both memory, speed and programming affects.
    If you don't declare them the editor will guess what they are and can get them wrong and cause you to get incorrect results (although current VB Editors are pretty good at guessing).
    If it is not sure it will assign the variable as a "Variant" which it will then have to change while the program is running, which can be very inefficient.
     
  4. mrl

    mrl Thread Starter

    Joined:
    Aug 12, 2007
    Messages:
    340
    Hi Rockn,
    Opps, yea I mean Dim :D

    Hi OBP,
    Now I know why the maco sometines run slow and somtimes when I use the recorder, I get the worng results.
    Thanks to both of you


    Mike :D :D
     
  5. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Macros are far less efficient than well written VBA.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1026840

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice