+ Reply to Thread
Results 1 to 3 of 3

Another stupid newbie question.

  1. #1
    mato nanjin
    Guest

    Another stupid newbie question.

    I am trying to dim some variables as public. I have this statement (among
    others) in a module in the Auto_Open Sub:

    "Public dtPropDate As Date ' quote date"

    I get the following error message when the workbook loads:

    "Compile error. Invalid atribute in Sub or function"

    Any ideas why I get this?

    How can I screw up something this simple?

    Thanks, Ron

  2. #2
    Bob Phillips
    Guest

    Re: Another stupid newbie question.

    It sounds as though you have declared it as part of a sub. In a sub it must
    be a Dim. Public is used to declare a global variable, but it must be
    declared outside of, and before, any procedures.

    --

    HTH

    Bob Phillips

    (replace xxxx in the email address with gmail if mailing direct)

    "mato nanjin" <matonanjin.nospam@yahoo.com> wrote in message
    news:491B3FD7-05AD-4304-A1B2-DC31A28DBF43@microsoft.com...
    > I am trying to dim some variables as public. I have this statement (among
    > others) in a module in the Auto_Open Sub:
    >
    > "Public dtPropDate As Date ' quote date"
    >
    > I get the following error message when the workbook loads:
    >
    > "Compile error. Invalid atribute in Sub or function"
    >
    > Any ideas why I get this?
    >
    > How can I screw up something this simple?
    >
    > Thanks, Ron




  3. #3
    Forum Contributor
    Join Date
    03-16-2004
    MS-Off Ver
    2016
    Posts
    175
    mato nanjin

    I a dumb newbie too but I think I may be smart enough to answer your question. You cant use certain words that are "reserved" like "Public" as a variable. I think the way to write this is:

    Dim dtPropDate As Date

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1