Re: Array Declaration Problem ??

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi;

1) It seems that after setting the ref. in VBA to atpbaen.xls your Demo
works fine without the WorkSheetFunction object and the With structure:

Sub Demo()
Dim c As String
c = complex(3, 4)
MsgBox ImAbs(c)
End Sub

2) Is this a general rule ?? ... i.e.; if one sets the ref. to atpbaen, then
one should be able to use any XL w/s function in VBA ??

3) Or, the atp ref. only allows the direct use (not through the
WorkSheetFunction object) of those listed under:
VBA Help::"Using Microsoft Excel Work*** Functions in Visual Basic"::
"List of Work*** Functions Available to Visual Basic"

Would appreciate your comments.

Thank you.


"monir" wrote:

Hi Dana;

I couldn't access the link, but it most likely refers to my other post!
Your idea is excellent and NEW.
I selected the vba ref atpvbaen.xls and tried your demo (copy/paste).
It produces Run-time error '438': Object doesn't support this property or
method"
and the statement: c = .Complex(3, 4) is highlighted.

Is there something else beside the ref. atpvbaen.xls ?? (I'm using XL 2003,
Win XP)

Regards.


"Dana DeLouis" wrote:

As a side note, I noticed in the thread at:

http://www.mrexcel.com/forum/printthread.php?s=5450aaf5a5033dc8769d9015ff0
5c420&t=322333

that near the end of the thread they mention it was not possible to
translate the Fortran version directly because vba can not use Complex
functions.
Well, that's not entirely true.
If one sets a vba reference to atpvbaen, then it is possible to do stuff
like this.
This returns the correct answer of 5.

Sub Demo()
Dim c As String

With WorksheetFunction
c = .Complex(3, 4)
MsgBox .ImAbs(c)
End With
End Sub

--
HTH :>)
Dana DeLouis


"Dana DeLouis" <ddelouis@xxxxxxxxxxxxx> wrote in message
news:E7C7B7FD-DE74-48D0-B361-25E6B2333BF1@xxxxxxxxxxxxxxxx
Hi. I think I've copied your code & data correctly, but I keep getting
the message ""Too many iterations..."
and them the program aborts near the end with Atan2(0,0) (thus
causing an error)

Feel free to send my your workbook. I'd be glad to take a look at it.
Do you have a reference for the code?
--

Dana DeLouis

<snip>

.


Quantcast