View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Complex numbers in VBA (Excel(

Actually you don't have to do that

sStr = Application.Run("ATPVBAEN.XLA!IMPRODUCT","3+4i","5-3i")

so to demonstrate from the immediate window:

sStr = Application.Run("ATPVBAEN.XLA!IMPRODUCT","3+4i","5-3i")
? sStr
27+11i

This assume the Analysis Toolpak - VBA has been selected in Tools=Addins.

If you create a reference to ATPVBAEN.XLA you can call it like a built in
VBA function

sStr = IMPRODUCT("3+4i","5-3i")

but to the best of my knowledge, VBA itself does not support complex
numbers.

--
Regards,
Tom Ogilvy

"levent" wrote in message
...
would anyone know if one can use complex data type in VBA
(Excel). i know that you can do operations with comlex
numbers using Excel's Engineering formula package, but I
would prefer it if VBA was able to handle it directly.

also does it matter the version (i would prefer Excel 97,
but if not Excel 2002)