View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Force use of standard function

You can't have it both ways, so RENAME your function:

Actually you can have it both ways. Use

VBA.Year for the VBA function and
Me.Year for the class module function.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Mark,

You can't have it both ways, so RENAME your function:

Sub Test()
MsgBox myYear("1/2/2007")
End Sub

Function myYear(inDate As Date) As Integer
myYear = Year(inDate)
End Function

HTH,
Bernie
MS Excel MVP


"Mark Olsen" wrote in
message
...
Hi,
I have a class module that has a function called Year().
Normally, this is
fine but in the class module I use the standard vba function
Year() to
extract the year from a date. However, vba thinks that this
is the class
modules Year() function. How can I tell it to use the
standard Year()
function without changing the name of the Year() function in
my class module.