Re: Error when using VBScript arrays

From: Chris Harrington (charringtonDEL_at_ETEactiveinterface.com)
Date: 04/04/04


Date: Sat, 3 Apr 2004 23:43:12 -0500

Thanks Michael. I'll give that a try.

"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:%236uOeKHGEHA.1240@TK2MSFTNGP10.phx.gbl...
> Chris Harrington wrote:
> > I am automating PowerPoint from WSF using VBScript. Everything is
> > fine, except when I try to call AddPolyline, passing an array of
> > points. I get the error "the specified value is out of range". I
> > assume that it is not getting the type of array it needs
> > (safearray?). Is there any way to handle this in VBScript? Also, I
> > get the same error if I try JScript.
> >
> > Someone suggested to do
> > triArray(0, 0) = CSng(25)
> > but that didn't change things.
> >
>
>
> The AddPolyline method (according to the docs) wants a 2D array of type
> Single. Script clients can only create arrays of variants. Even if the
> variant subtype is Single, it's not the same thing. A soultion is to
write
> a COM helper that could convert a 2D array of variant singles to a 2D
array
> of singles.
>
>
>
> >
> > ....
> >
> > Dim triArray(3,1)
> >
> > triArray(0, 0) = 25
> > triArray(0, 1) = 100
> > triArray(1, 0) = 100
> > triArray(1, 1) = 150
> > triArray(2, 0) = 150
> > triArray(2, 1) = 50
> > triArray(3, 0) = 25
> > triArray(3, 1) = 100
> >
> > slide1.AddPolyline triArray
> >
> > ....
>
> --
> Michael Harris
> Microsoft.MVP.Scripting
> Sammamish WA US
>



Relevant Pages

  • Error when using VBScript arrays
    ... I am automating PowerPoint from WSF using VBScript. ... except when I try to call AddPolyline, passing an array of points. ...
    (microsoft.public.scripting.vbscript)
  • Re: improving my code: array of references
    ... are you assigning its return value to the scalar passed as a parameter? ... I think the issue is what you mean by "modifies". ... Either you should be using a array from the beginning, ... big I am going to be passing around lots of data. ...
    (perl.beginners)
  • Re: 3rd and Final Post OCX Design Question
    ... whether there would be any difference in speed hit by creating the array on ... the client and passing a reference to the array or passing the picture and ... >> What is the difference between passing a picture as IPictureDisp as ... > the reference to the object. ...
    (microsoft.public.vb.general.discussion)
  • Re: Proper use of delegates.
    ... the compiler will do it for you as long what you're passing doesn't look like an objectto the compiler. ... But any time you don't need to pass an array of parameters, yes...you could explicitly do the cast just to make sure that the overload you want is the one that's actually used. ... Then, what you're passing is always an object, with some number of elements equal to the number of parameters for the method. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Over 29 args in a UDF with double parens
    ... using the extra parenthesis will pass all references as an array to the ... else you could test against passing multiareas ... If you write a UDF 'to the max': ... > could somehow determine what cell references were passed. ...
    (microsoft.public.excel.programming)