Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Kennett Square, Pennsylvania, USA
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    compile error (office XP professional)

    I recently developed a set of automated forms using Excel VB. The workbook and all of its associated macros works fine on my desktop and laptop computer however when I transferred the workbook to another computer system the user receives the error "compile error: Can't locate project or library". It does not appear to be a macro security issue and it also does not appear to matter whether a user has administrative rights or standard user rights. My desktop system is Windows XP home with office XP professional and the user's PC is Windows XP professional with office XP standard.

    What is even more frustrating is that the workbook will work fine on another user's PC in the same office (as the user). There seems to be no rhyme or reason to this issue.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: compile error (office XP professional)

    Do the following on the PC where the problems occur:
    - Open the Visual Basic Editor.
    - Select Tools | References...
    - For a workbook with userforms, you need the following references at the least:
    - Visual Basic for Applications
    - Microsoft Excel 10.0 Object Library
    - Microsoft Forms 2.0 Object Library
    And the following two are ticked by default, although you don't always need them:
    - OLE Automation
    - Microsoft Office 10.0 Object Library

    Do you see references starting with MISSING? If so, note which ones they are, then clear their check boxes and click OK. If the code works correctly now, fine. Otherwise, you'll have to find out if and where the missing object libraries are available on the PC, and set new references for them.

  3. #3
    Star Lounger
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: compile error (office XP professional)

    Hi Bill,

    please check if you have declared all your variables.

    If not, it sometimes causes VBA to look for references, which are not needed at all. Usually you will not see it on your computer, but only when you send it to others. In my experience it is not happening in a systematic way.

  4. #4
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Kennett Square, Pennsylvania, USA
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: compile error (office XP professional)

    Thanks Hans and Wolf for your replies. I will try both at the school Monday morning hopefully to resolve this issue.

  5. #5
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Kennett Square, Pennsylvania, USA
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: compile error (office XP professional)

    Hans - It appears the missing object is Microsoft calendar control 10.0. If the user trys to uncheck it, VB complains that the object is in use. If we try to load excel with out the workbook loaded, MS Calendar control is no where to be found in the list of references.

    How do I locate this control on the user's (or my) PC? If it can not be found on the user's PC can it be transferred to the user's PC?

    Thanks for your help.

  6. #6
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Kennett Square, Pennsylvania, USA
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: compile error (office XP professional)

    Hans - one other question: The object browser says that sheet 10 in my workbook contains a calendar control. But It doesn't.. If I go to Sheet 10 under Excel Objects, I have (General), Calendar1, and Worksheet listed on the drop down list. How do I get rid of Calendar1 when there is no calendar contron on the worksheet. Excel apparently thinks there is - so how do I 'unconfuse' Excel?

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: compile error (office XP professional)

    The Calendar control comes with Microsoft Access (and hence with Office Pro). Does the system where the problem occurs have Access installed?

    The replies in the thread starting with <post#=315082>post 315082</post#> contain several methods to locate and to delete objects on worksheets. Make a copy of the workbook before trying them, just to be on the safe side.

  8. #8
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Kennett Square, Pennsylvania, USA
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: compile error (office XP professional)

    My system where the workbook was developed has Office Pro - but the PCs where the wrokbook will be used have Office Std. - i.e., no Access. Why should that be a problem?

    Thanks.

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: compile error (office XP professional)

    There is a file that provides the functionality of the calendar: MsCal.ocx. This file is needed for the calendar control to work, but it is not present on PC's with the standard version of Office. You would need the Office Developer Edition to distribute MsCal.ocx.

  10. #10
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Kennett Square, Pennsylvania, USA
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: compile error (office XP professional)

    Thanks, Hans. If I am not using a calendar control anywhere in my project, why would Excel VBA complain about the absense of mscal.ocx?

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: compile error (office XP professional)

    Somebody must have added a calendar control to the workbook sometime, since there is a reference to the Calendar control. You mentioned that you can't remove this reference; this either indicates that there must still be a calendar control, or the workbook has become corrupted. If you don't want to use the link I provided earlier in this thread, it might be easiest to copy all sheets, modules and userforms to a new workbook. References aren't copied automatically.

  12. #12
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Kennett Square, Pennsylvania, USA
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: compile error (office XP professional)

    I think the workbook somehow has been corrupted. I already moved the one sheet where the calendar control object supposedly is located to a new, clean worksheet, but that did not seem to help. It eliminated the reference to calendar on the sheet objects list, but the user reported that the macros still would not function.

    It will copy all of the other sheet to a new workbook and try again.

    What did you mean about using the link provided earlier? Was this the message concerning the MSCAL.OCX file?

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: compile error (office XP professional)

    In <post#=317671>post 317671</post#> I referred to <post#=315082>post 315082</post#>; this thread contains several methods to locate and/or delete objects on a worksheet; you could try these to see if you can find a calendar control.
    And are you sure that the workbook doesn't contain a userform with a calendar control?

  14. #14
    2 Star Lounger
    Join Date
    Nov 2003
    Location
    Kennett Square, Pennsylvania, USA
    Posts
    114
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: compile error (office XP professional)

    Hans - thanks again. No - the worksheet does not contain a user form with a calendar control. I wish it was that simple. You may have seen my message under Post 315082 as I was trying to run the code to resize objects and I could not get the code to work. Your macro does identify that there is an object or a shape in cell E7 on the worksheet but I cannot see it. Even if I press F5 and go to special, objects, that does not highlight it either. This is certainly frustrating.

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: compile error (office XP professional)

    If you use GoTo, Special..., Objects, then press Delete, this should delete all objects, even if you can't see them.

Page 1 of 2 12 LastLast

Posting Permissions

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