Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Compile Error (XP)

    I am in the process of testing XP SP2 in development and have encountered the following Excel compile error when I try to open a file containing the following code:

    Compile Error:
    Can't Find project or library


    Sub Msg1()
    Msg = "Finished !"
    DialogStyle = vbOKOnly + vbCritical + vbDefaultButton2 Errors out on DialogStyle
    Title = "Status"
    Response = MsgBox(Msg, DialogStyle, Title)
    End Sub

    The irony of this error message is I did nothing but upgrade to XP SP2. This should not have an effect on Excel. The file opens just fine on another machine without SP2. And ran just fine prior to the upgrade to SP2.

    Any thoughts as to why?

    Thanks,
    John

  2. #2
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compile Error (XP)

    I substituted all references of "DialogStyle" with "Sytle" and the code works.

    I still do not grasp how upgrading the operating system to SP <img src=/S/grin.gif border=0 alt=grin width=15 height=15> impacts the code.

    John

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Compile Error (XP)

    Do you have all your Library references set? It doesn't error out in 2003, but you are trying to set the second button as the default when there's only the OK button, so you don't need vbDefaultButton2.
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Compile Error (XP)

    John,

    The library references are the same on the machine with and without XP. The first mgsbox would appear, once it was clicked then the other would appear.

    My issue was with the compile error. It should never have error out under XP SP2.

    John

Posting Permissions

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