Date error message (VBA)

bruty

Active Member
Joined
Jul 25, 2007
Messages
456
Office Version
  1. 365
Platform
  1. Windows
I created a spreadsheet using Office 2003 on an XP machine that on open looks at todays date and checks it against a shelflife date using this code:

TodaysDate = Date

When a colleague using Excel 2000 on a Windows NT (or 2000, not 100% sure at the moment) tries to open up the spreadsheet they get an error saying:

Compile Error:
Can't find project or library

and it highlights the word Date (the one after the equals sign). I thought this was a standard VBA keyword, so I don't understand why this is causing a problem. Can anyone shed some light for me??
 
Would using TodaysDate = Now be any better than using TodaysDate = Date?
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Like this?

Code:
Sub EnableControl(Id As Integer, Enabled As Boolean)
'Disables control for cut, copy & paste in command bars
Dim CB As CommandBar
Dim C As CommandBarControl
On Error Resume Next
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub
 
Upvote 0
Ok
Now do you have a sub routine called "Error" for
Rich (BB code):
Application.OnKey "^c", "Error"
?
 
Upvote 0
Yep:

Code:
Sub Error()
'Error message for disabled events (cut, copy & paste)
MsgBox "This option has been disabled"
End Sub
 
Upvote 0
Bruty

I would suggest you don't call the sub Error as Error is a reserved word.
 
Upvote 0

Forum statistics

Threads
1,216,031
Messages
6,128,422
Members
449,450
Latest member
gunars

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