Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2003
    Location
    Sydney, New South Wales, Australia
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have an add-in that works fine for most people that use it. There is one user, however, where the code wont compile. It seems to require every variable to be declared. The modules compile OK when the variables are all declared but I have been lazy and there are many modules where not all variables are declared.

    I realise the simple solution is to adopt best practice and declare all variables.

    But does anyone know why the code wont compile on this user's PC?

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Mark,

    There is a check box in the VBE that forces the Option Explicit at the top of every module you create. I don't know it this will also add it to modules in add-ins or not.

    Is this one weird user using the same version of Excel?
    Does this machine have the same Macro security levels?

    Just some of the places I'd check.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Star Lounger
    Join Date
    Mar 2003
    Location
    Sydney, New South Wales, Australia
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It appears that the problem of not compiling was nothing to do with the undeclared variables.

    Somehow, my add-in managed to get a reference to the Ref Edit Control which I don't use.
    When the Ref Edit Control is not found, the module wont compile and simply says there is a compile error in a hidden module even though there is nothing wrong with the code (apart from undeclared variables).
    I removed the reference and now all appears to be OK.

Posting Permissions

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