Thanks for you guys help.

$Bill Luebkert <[EMAIL PROTECTED]> found that is a typo of the
document: <ActivePerl User Guide>.

Win32::OLE::NEWS - What's new in Win32::OLE 
The VARIANT->Put(ARRAYREF) form allows assignment to a complete SAFEARRAY
This allows automatic conversion from a list of lists to a SAFEARRAY.
You can now write:

my $Array = Variant(VT_ARRAY|VT_R8, [1,2], 2);
############################################
# It should be:
# my $Array = Variant(VT_ARRAY|VT_R8, [0,1], 2);
############################################
$Array->Put([[1,2], [3,4]]);

instead of the tedious:

$Array->Put(1,0,1);
$Array->Put(1,1,2);
$Array->Put(2,0,3);
$Array->Put(2,1,4);




On 6/1/05, Anderson, Mark (Service Delivery) <[EMAIL PROTECTED]> wrote:
> perl 5.8.4 on NT4
> 
> 
> C:\>perl -e "use Win32::OLE;use Win32::OLE::Variant; my
> $Array=Variant(VT_ARRAY|
> VT_R8,[1,2],2); $Array->Put([1,2],[2,3]); "
> 
> Win32::OLE(0.1701): Win32::OLE::Variant->Put(): Wrong number of indices;
> dimension of SafeArray is 2 at -e line 1.
> 
> 
> This works fine... it's normally easier not to create your own arrays,
> though... if you can retrieve a possibly empty array from the OLE object and
> modify that or just assign your own array (or anon array) back to it. The
> OLE module handles the conversion for you and saves tons of hassle.
> 
> C:\>perl -e "use Win32::OLE;use Win32::OLE::Variant;
> my $Array=Variant(VT_ARRAY|VT_R8,[1,2],2); $Array->Put(1,qw/a b/); "
> 
> 
> C:\>perl -e "use Win32::OLE;use Win32::OLE::Variant ;use Data::Dumper;
> my $Array=Variant(VT_ARRAY|VT_R8,[1,2],2); print 'Dimensions: ' ;
> @s= $Array->Dim ; print qq/@s $#s...\n/; print Dumper([EMAIL PROTECTED]);"
> 
> Dimensions: ARRAY(0x15d7c70) ARRAY(0x15d7d84) 1...
> $VAR1 = [
>          [
>            1,
>            2
>          ],
>          [
>            0,
>            1
>          ]
>        ];
> 
> 
> 
> Kind regards,
> 
> Mark Anderson
> Service Improvement Programme
> Level 2, 113 Dundas Street
> Edinburgh, EH3 5DE
> Tel: 0131 523 8786
> Mob: 07808 826 063
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [SMTP:[EMAIL PROTECTED]
> > Sent: Wednesday, June 01, 2005 7:21 AM
> > To:   perl-win32-users@listserv.ActiveState.com
> > Subject:      It seems that Win32::OLE::Variant doesn't work!
> >
> > *** WARNING : This message originates from the Internet ***
> >
> > It seems that Win32::OLE::Variant doesn't work!
> >
> >
> > Below is the script:
> > ##########################################################################
> > ##
> > #! perl -W
> >
> > use strict;
> > use Win32::OLE;
> > use Win32::OLE::Variant;
> >
> > my $Array = Variant(VT_ARRAY|VT_R8, [1,2], 2);
> > $Array->Put([[1,2], [3,4]]);
> >
> >
> > Below is the warning message:
> > ##########################################################################
> > ##
> > C:\>tst.pl
> > Win32::OLE(0.1702): SetSafeArrayFromAV bad index at C:\tst.pl line 10.
> > Win32::OLE(0.1702) error 0x8002000b: "Invalid index" at C:\tst.pl line 10
> >         eval {...} called at C:\tst.pl line 10
> >
> >
> > I am using the following version of perl:
> > ##########################################################################
> > ##
> > This is perl, v5.8.6 built for MSWin32-x86-multi-thread
> >
> > Do you guys have the similar problem?
> >
> >
> > Another quetions is:
> > my $Array = Variant(VT_ARRAY|VT_R8, [1,2], 2);
> > ##########################################################################
> > ##
> > What do 1, 2, 2 mean respectively?
> > Thy mean the lower boundary of the second dimension, the upper
> > boundary of the second dimension,
> > and the total number of dimension?
> >
> >
> > Thank in advance!
> >
> > _______________________________________________
> > Perl-Win32-Users mailing list
> > Perl-Win32-Users@listserv.ActiveState.com
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
> 
> The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered 
> Office: 36 St Andrew Square, Edinburgh EH2 2YB
> 
> The Royal Bank of Scotland plc is authorised and regulated by the Financial 
> Services Authority and represents The Royal Bank of Scotland Marketing Group. 
> The Bank sells life policies, collective investment schemes and pension 
> products and advises only on the Marketing Group's range of these products 
> and on a With-Profit Bond produced by Norwich Union Life (RBS) Limited.
> 
> This e-mail message is confidential and for use by the addressee only. If the 
> message is received by anyone other than the addressee, please return the 
> message to the sender by replying to it and then delete the message from your 
> computer. Internet e-mails are not necessarily secure. The Royal Bank of 
> Scotland plc does not accept responsibility for changes made to this message 
> after it was sent.
> 
> Whilst all reasonable care has been taken to avoid the transmission of 
> viruses, it is the responsibility of the recipient to ensure that the onward 
> transmission, opening or use of this message and any attachments will not 
> adversely affect its systems or data. No responsibility is accepted by The 
> Royal Bank of Scotland plc in this regard and the recipient should carry out 
> such virus and other checks as it considers appropriate.
> 
>

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to