找回密码
 立即注册
搜索

用宏画的曲线,怎么在宏中用代码改变线型和颜色?

0
回复
429
查看
[复制链接]

21

主题

238

帖子

52

幻币

一流武者

Rank: 3Rank: 3

积分
278
QQ
2016-4-12 13:25:05 显示全部楼层 |阅读模式
学习VBA,用宏画了的一些曲线,颜色和线型都是默认的。请教各位高手,怎样才能在宏中用代码指定线型和颜色?
还有,代码中指定了ActivePresentation.Slides(1),怎样才能将曲线画在当前幻灯片中?
宏代码如下:
Sub DrawSin()
Const PI As Single = 3.1415
Const Period As Single = 200
Dim i As Single, n As Single, m As Single
Dim sinArray() As Single
n = InputBox("请输入周期数", "周期", 2, 300, 200)
m = InputBox("请输入起始角度", "起始角度", 0, 300, 200)
x = Int(n * Period / 3) * 3 + 1 '必须的,点数为 3n+1
ReDim sinArray(1 To x, 1 To 2) As Single
For i = 1 To x
sinArray(i, 1) = 100 + i
sinArray(i, 2) = 200 - 50 * Sin(2 * PI * i / Period + m * PI / 180)
Next
'添加贝塞尔曲线
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddCurve SafeArrayOfPoints:=sinArray
End Sub
PPT学习论坛
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册