Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: Problem Calling Current Date in Macro

  1. #1
    Board Regular Steve Hartman's Avatar
    Join Date
    Feb 2002
    Location
    Houston,Texas
    Posts
    417
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a macro that populates a userform when the workbook is opened. The following lines of code places the current date in a text box named TestDate:

    With Me.TestDate
    .Text = Date
    End With

    My problem is that this works on some machines and not on others. All the machines are running Excel 97 SR-1 with all the same add-ins. Any ideas what is causing the problem?

    [ This Message was edited by: Steve Hartman on 2002-02-20 15:39 ]

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-02-20 15:38, Steve Hartman wrote:
    I have a macro that populates a userform when the workbook is opened. The following lines of code places the current date in a text box named TestDate:

    With Me.TestDate
    .Text = Date
    End With

    My problem is that this works on some machines and not on others. All the machines are running Excel 97 SR-1 with all the same add-ins. Any ideas what is causing the problem?

    [ This Message was edited by: Steve Hartman on 2002-02-20 15:39 ]
    Steve, when you say it doesn't work on some
    machines, what is happening...is there an
    error or isthe format not right ??

    Ivan

  3. #3
    Board Regular Steve Hartman's Avatar
    Join Date
    Feb 2002
    Location
    Houston,Texas
    Posts
    417
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the reply.


    Steve, when you say it doesn't work on some
    machines, what is happening...is there an
    error or isthe format not right ??

    Ivan
    The macro is launched when the workbook opens. On some machines I get my Userform with the default values in the boxes. On the other machines I get the Microsoft Visual Basic error window:

    Compile error:
    Can't find project or library

    the VBA editor is opened and Date is highlighted in the section of code that I posted earlier.

    Steve

    [ This Message was edited by: Steve Hartman on 2002-02-21 11:58 ]

  4. #4
    Board Regular Steve Hartman's Avatar
    Join Date
    Feb 2002
    Location
    Houston,Texas
    Posts
    417
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Any other ideas?

  5. #5
    Board Regular Steve Hartman's Avatar
    Join Date
    Feb 2002
    Location
    Houston,Texas
    Posts
    417
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Just a message to move this back up front in a last attempt to get an answer. ANYBODY ever seen this before?

  6. #6
    Board Regular Steve Hartman's Avatar
    Join Date
    Feb 2002
    Location
    Houston,Texas
    Posts
    417
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Finally figured this one out inderectly by stumbling around in the Microsoft Knowledge Base and wanted to post the solution to maybe save someone else several days of grief.

    When the error occurs, you go into Tools>References in the VBA editor. This shows you a list of available reference libraries, with check marks by the ones your project is using I think. I had one checked that was listed as MISSING. (It was Microsoft Windows Common Controls 5.0(SP2) if anyone is interested) Simply unchecking this one solved the problem.

    I still don't know WHY this occured since the error was occuring on both Windows/Excel 2000, Windows 95/Excel 97, and Windows 98/Excel 97 systems. On each of these combinations it would run on some machines but not on others. Interestinlgy, it would not run on the machine that it was initially created on and used to run just fine on! Go figure.

    Just sign me formerly
    [ This Message was edited by: Steve Hartman on 2002-02-27 15:07 ]

    [ This Message was edited by: Steve Hartman on 2002-02-27 15:08 ]

    [ This Message was edited by: Steve Hartman on 2002-02-27 15:11 ]

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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