Can some give me reason for this

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • syedshaffee
    New Member
    • Jan 2012
    • 91

    Can some give me reason for this

    Hey people,

    I have a line of code which is Wrong I want to Known the reason Why it is so
    Code:
    private dim a as integer
    I Known we can use only one of this for defining a variable.

    What is the reason for that why can't we use both in vb

    Please help on this guys......?
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    You need to provide more context.
    If this line is in the declarations section of the module then the DIM is implied, remove it.
    Private will restrict the scope of the variable to the calling module.

    As for why one is allowed or not allowed in VBA vs VB... that is an impossible to answer question in that you'd have to understand the minds of the developers.

    -z

    -z

    Comment

    • syedshaffee
      New Member
      • Jan 2012
      • 91

      #3
      Thank u For a your reply

      Comment

      • yus2aces
        New Member
        • Sep 2012
        • 14

        #4
        Yup... you got to choose
        Code:
        dim a as integer
        in procedure declaration level
        or
        Code:
        private a as integer
        in module level declaration level if you would like to use this within all procedures in the module where it is declared.

        Comment

        Working...