Powerpoint VBA Run-time error '-2147024809 (80070057)': The specified parameter has an incorrect data type

46 Views Asked by At

Posting this answer-your-own question because I saw many posts with identical error message, each post being unique.

  Sub makeCurve()
  Const numpts = 7
    Dim pts(1 To numpts, 1 To 2 )
    For i = 1 to numpts
      pts(i, 1) = 10 + i * 72 / 2
      pts(i, 2) = 10 + i * 72 / 2
    Next
    Set myDocument = ActivePresentation.Slides(1)
    With myDocument.Shapes.AddCurve(pts).Line
      .ForeColor.RGB = RGB(0, 0, 0)
      .Weight = 1.5
    End With
  End Sub

Will give the following when trying to run the sub:

Run-time error '-2147024809 (80070057)':

The specified parameter has an incorrect data type

How to resolve the error?

1

There are 1 best solutions below

0
elscan On
  Dim pts(1 To numpts, 1 To 2)

must be changed to

  Dim pts(1 To numpts, 1 To 2) As Single