View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default using dateserial in vb

First, I wouldn't use date for a variable name since it is a vba keyword.
Second, if you declare it as an integer, you can't use dates after 9/16/89
w/o getting an overflow error. Third, leave out application when you call
dateserial.

Try:

Dim lngDate as long
lngDate = DateSerial(acctyr, acctmon, 1)


"mwam423" wrote:

am trying to convert date info into it's serial date value with following
code (month and year provided by user):

acctmon = Application.InputBox("Please enter month value between 1 and 12",
"Enter month", Month(Now), , , , , 1)

acctyr = Application.InputBox("Please enter year", "Enter year", Year(Now),
, , , , 1)

Dim date As Integer
date = Application.DateSerial(acctyr, acctmon, 1)

however, get the error message: run-time error '438': object doesn't support
this property or method

what does this mean, and what do i have to do to return a serial value? (is
there another function i can use to accomplish this?)