Archive of Mr Excel Message Board


Back to General Excel archive index
Back to archive home

A Customized Add-in problem...

Posted by Vikram Peddakotla on November 06, 2000 6:51 PM
Hi,
I have a function in my Add-in which takes 3 parameters (2 date parameters and a string paramater).
for example:
Function Test (Date1 as date, Date2 as date, String1 as string)

When I select a value for Date1 from the spreadsheet, the parameter gets the date value (ie. if I select a cell containing 12/12/2000, then Date1 gets the value 12/12/2000)

But when I manually enter 12/12/2000, the parameter get a value of 0.00056 (which I suspect that Excel, treats the data as numeric and does 12 div 12 div 2000, instead of treating it as a date parameter)

How do I get Excel to understand that a parameter is a date ot a text value ? I am working on Excel 97.

I would appreciate if anyone could help me out.

Thanks and Regards,
Vikram.


Re: A Customized Add-in problem...

Posted by Ivan Moala on November 06, 2000 11:51 PM

Vikram
When entering your dates manually just enclose it
in "" eg "12/12/2000" by default your variables
are referenced ByRef that is the address of an argument is passes to your procedure instead of passing the value. This allows the procedure to access the actual variable. As a result, the variable's actual value can be changed by the procedure to which it is passed, so it is looking
for an address UNLESS it it enclosed in " ".


HTH

Ivan



Re: A Customized Add-in problem...

Posted by Vikram Peddakotla on November 09, 2000 3:44 PM
Hey Ivan,

Thank you very much.

I greatly appreciate it.

Cheers,
Vikram.



This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.