Powerpoint VBA 运行时错误“-2147024809 (80070057)”:指定参数的数据类型不正确

问题描述 投票:0回答:1

发布这个回答你自己的问题是因为我看到很多帖子都有相同的错误消息,每个帖子都是独一无二的。

  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

尝试运行子程序时会给出以下信息:

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

The specified parameter has an incorrect data type

如何解决错误?

vbscript powerpoint bezier
1个回答
0
投票
  Dim pts(1 To numpts, 1 To 2)

必须更改为

  Dim pts(1 To numpts, 1 To 2) As Single
© www.soinside.com 2019 - 2024. All rights reserved.