+ Reply to Thread
Results 1 to 9 of 9

How to Recognize unnecessary reference files in the vbe

  1. #1
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    How to Recognize unnecessary reference files in the vbe

    Hi,
    I made an excell document with many many vba codes/procedures. While creating it, I was doing some tests/playing with the references in the visual Basic Editor.
    My problem is now I dont know which ones are necessary and which dont. I want to remove any unnecesarry reference. How can I know which ones are necessary for my project to run properly and which dont??

    I appreciate very much your help.
    Attached Images Attached Images
    Last edited by Wizz; 06-19-2009 at 05:12 AM.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to Recognize unnecessary reference files in the vbe

    Try unchecking them (apart from the first 5 if you have any forms) then compiling the project each time (Debug-Compile). If you get errors, you need the reference. (some you may not even be able to uncheck).
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    Re: How to Recognize unnecessary reference files in the vbe

    Nnice one !!
    That option looks very interesting. I've been checking Excel's help and the web, but couldnt find more info on what and how much does that function does.
    Do you have any source were I could read/learn more about the compiler??

    Thank you very much.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to Recognize unnecessary reference files in the vbe

    The compiler doesn't effectively do much more than a syntax check in reality (VBA is not a truly compiled language)

  5. #5
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    Re: How to Recognize unnecessary reference files in the vbe

    My interest in learning more is because:

    1- I deliberately misspelt "EnableEvents" ("EnnnableEeevents") and then run the Compiler. It found no error.

    2- While removing and compiling, in some cases, there was a bar wich counted the percentage compiled (very fast). But in some cases, nothing happened (after I pressed compile every option in the debug/compile menu was grey). When I removed another reference, it was black again.

    3- I was able to remove almos every reference but 4. From those, 3 reference I could not even uncheck, and the 4th showed me an error while definig a variable (Dim SelectMenu As FileDialog)

    4- When it finishes compiling, does it send a message or I just have to asume it finish compiling?

    Thanks a million romperstomper

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to Recognize unnecessary reference files in the vbe

    1. You should use Option Explicit which forces you to declare all variables (you can set this under Tools Options in the VBEditor). Otherwise the compiler would assume that your misspelled EnnnableEeevents was an undeclared variable. (though if you had used Application.EnnnableEeevents it wouldn't be an issue)
    2. That just means it was too fast!
    3. That was the point of the exercise.
    4. No, no message unless it finds an error.

  7. #7
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    Re: How to Recognize unnecessary reference files in the vbe

    Quote Originally Posted by romperstomper View Post
    (though if you had used Application.EnnnableEeevents it wouldn't be an issue)
    What do you mean with that? it would not have recognized it or the line should have worked fine if I ran the procedure?

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: How to Recognize unnecessary reference files in the vbe

    The compiler should have spotted that as an error.

  9. #9
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    Re: How to Recognize unnecessary reference files in the vbe

    Awesome !!
    Thats right, i was missing the "Option Explicit".

    Thanks verry much for the info. Very helpful...... VERY helpful.

+ 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