OLE::Variant array of strings

K

kevind0718

Hello:
I am attempting to access Bloomberg, an ActiveX control (a fincial
data source) via Perl. I can not figure out how to pass a variant
array of strings to the above ActiveX control.

Here is my PERL code.
use Win32::OLE;
use Win32::OLE::Variant;
$blpData = Win32::OLE->new('Bloomberg.Data.1') or
die "can NOT load the blpData" ; #print $blpData->Timeout . "\n";
$aSec = Variant(VT_BSTR, "IBM Equity");
@tmpArray = ("PX_Last");
$aFields = Variant(VT_ARRAY|VT_UI1, "PX_Last" );
$sDate = Variant(VT_DATE, "2007/07/01");
$eDate = Variant(VT_DATE, "2007/07/10");
@bbData = Variant(VT_EMPTY, undef);
@bbData = $blpData->BLPGetHistoricalData($aSec, $aFields, $sDate,
$eDate);
print "Array Size: " , $#bbData . "\n";
foreach $bbData (@bbData) {
print $bbData
}
print "end" ;

Here the documentation on the BLPGetHistoricalData call
VARIANT BLPGetHistoricalData (VARIANT Security, VARIANT Fields,
VARIANT StartDate, VARIANT EndDate,
VARIANT BarSize, VARIANT BarFields);
Security: in Specifies either a single security, or array of
securities as the basis of the request. See Security Syntax
Fields: in An array of Bloomberg field references, or mnemonics. All
applicable fields can be found in the bbfields.tbl data dictionary.
For a list of the three fields which can be used for an Intraday Time-
Bars request, see the Time-Bar Fields page.
StartDate: in Either an absolute date indicating the first date about
which data will be returned, or a numerical value relating to the
number of days back in history to report from. The latter type
indicates an intraday activity request. For more details, click the
StartDate link in the above method signature.
EndDate: in, optional Indicates the final date about which data will
be reported. Omitting this parameter causes all data to be reported up
until the current time of request.

Please note that the Fields parameter expects a variant.

Question: How do I create a variant array of strings?
I am getting an error on the Fields parameter.
Need help to make some VBA macros go away.


Thanks in Advance

KD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top