changes in the date function from 2000 to 2003?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got some code that uses the date function.

The computer I am using runs win2000pro and xl2000. The code below works
just fine.

If sD = 0 Then
selectDate = Date
Else
selectDate = sD
End If

But on all computers with winXP pro and xl2003 it stops on the line
'selectDate = Date' saying that the object is not defined or there is no
library reference available.

Any ideas why?
 
Date is a reserved word for the Date type. ie you could legally use it like:

dim d as date

I don't know if it's a version thing, I'm supprised "= Date" ever worked.
You might be looking for the "now()" function which returns the current
system time?


- Rm
 
Hi Robert,
Date is a reserved word for the Date type.

Date is a VBA functio which returns the system date.

From the immediate window:

?Date
07/10/2005
 
Hi JNW,

On the problem computer, in the VBE go to Tools | References and look for
any references marked as "MISSING".

Either uncheck the reference or, if the reference is needed, try the browse
button to locate the library,
 
so it is. Live and learn don't you.

- Rm

Norman Jones said:
Hi Robert,


Date is a VBA functio which returns the system date.

From the immediate window:

?Date
07/10/2005
 
Norman,

Thank you for your help. I actually looked for a missing reference prior to
posting and didn't see one. Also, all of the same references are checked on
both computers.

Is there another function that is usable instead of DATE in case the problem
cannot be resolved (if I submit a ticket to IT to update the references it
will never happen)

Thanks again,
JNW
 
Hi Robert,
Is there another function that is usable instead of DATE in case the problem
cannot be resolved (if I submit a ticket to IT to update the references it
will never happen)

I very much doubt that there is any intrinsic problem with the Date function.
Thank you for your help. I actually looked for a missing reference prior to
posting and didn't see one. Also, all of the same references are checked on
both computers.

At the risk of engendering your ire, I am still going to plump for the
reference problem. So, if you are prepared to humour me:

Close all workbooks except for the workbook in question
Run the problematic code
When the code errors, go to the VBE and select the project in the Project
Explorer window
Hit the reset button and look at the Tools | References list - are you
*sure* that no references are marked "Missing"?
 
Norman,

Thanks again. That did it. Don't worry about "engendering ire". I'm new
enough with this that sometimes all it takes is a second look.

JNW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top