Problem Calling Current Date in Macro

Steve Hartman

Active Member
Joined
Feb 17, 2002
Messages
417
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? :confused:
This message was edited by Steve Hartman on 2002-02-20 15:39
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
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? :confused:
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
 
Upvote 0
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
 
Upvote 0
Just a message to move this back up front in a last attempt to get an answer. ANYBODY ever seen this before?
 
Upvote 0
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 :biggrin:
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
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,202
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top