+ Reply to Thread
Results 1 to 11 of 11

Compile error with coding for date in textbox......2007 to 2010 issue!!!

  1. #1
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Compile error with coding for date in textbox......2007 to 2010 issue!!!

    Hello,

    As the title explains I am having problems with a userform showing todays date. I had datepicker control originally on my userform but I could not get it to default to todays date when using the file on both 2007 & 2010. I then used a control called monthview which is not available on 2007. I decided that the easiest way would be to use a textbox on the userform with the following code:

    Please Login or Register  to view this content.
    This worked great on my 2007 version at home but to my amazement when I tried it on 2010 version at work I am getting the following error:

    Compile Error:
    Cant find project or library

    If I change the first line to UserForm1 the macro runs but no date is in the textbox!!!!!

    Can anyone help??

    This is very annoying for such a simple operation.


    Thanks,

    Tony.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    If possible please share the screenshots


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    Capture1.PNG

    Not sure what screenshots you want but I have attached one of the code error.

    Thanks,

    Tony.

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    Thanks for the screenshot and clicking the Ok button highlights which part of the code?

  5. #5
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    Sorry to butt in - but there's most likely a missing reference in the Tools/References dialogue... Look for an entry starting 'MISSING:' and it is not necessarily related to the code that's throwing the error.

  6. #6
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    Hi sixthsense

    Another screenshot attached showing what is highlighted. Capture2.PNG

  7. #7
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    Quote Originally Posted by cytop View Post
    Sorry to butt in - but there's most likely a missing reference in the Tools/References dialogue... Look for an entry starting 'MISSING:' and it is not necessarily related to the code that's throwing the error.
    Just unticked MISSING Microsoft Calendar control in the references & it seems to be working

    Would this mean that this needs doing on every pc that this file is used on???

    Thanks Cytop.

  8. #8
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    Quote Originally Posted by Bflare View Post
    Hi sixthsense, Another screenshot
    Please refer cytop suggestion on Post #5 and if possible please share the screenshot of that references too

  9. #9
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    ..Would this mean that this needs doing on every pc that this file is used on?
    Depends on how you work. It there are 'local' copies of the file scattered all over the place - yes; but only for those machines running 2010. If you have a 'template' you distribute then edit that and then re-distribute.

  10. #10
    Forum Contributor
    Join Date
    07-02-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    109

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    Quote Originally Posted by cytop View Post
    Depends on how you work. It there are 'local' copies of the file scattered all over the place - yes; but only for those machines running 2010. If you have a 'template' you distribute then edit that and then re-distribute.
    The file has not been distributed yet so guess I will be ok.

    Thanks guys

    Tony.

  11. #11
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Compile error with coding for date in textbox......2007 to 2010 issue!!!

    Hi Tony,

    See the following post which uses a custom 'date picker' written entirely in VBA.
    http://www.excelforum.com/excel-gene...-combobox.html

    Lewis

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Compile Error on MsgBox coding
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2013, 03:27 PM
  2. [SOLVED] Compile error: cant find project or library (transferring from MS 2010 to 2007 or older)
    By JustLukas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-11-2013, 03:53 AM
  3. [SOLVED] VBA Compile Error in Excel 2007 Only NOT 2007 Professional
    By SAsplin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-15-2013, 07:29 AM
  4. File works in 2007 but gets compile error in 2010
    By fastcar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2013, 11:10 AM
  5. macro compile error in 2007 (not in 2010)
    By rvrajendra in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-19-2012, 06:25 AM

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