我写了一个vbs代码
Sub rectangle()
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, 10, 10, 200, 100).TextFrame
.Characters.Text = "This is a rectangle"
.HorizontalAlignment = xlHAlignCenter
.VerticalAlignment = xlVAlignCenter
ChDir "D:"
ActiveWorkbook.SaveAs Filename:="D:\Book.xls", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
ActiveWorkbook.Save
End With
ActiveWorkbook.Save
Range("F5").Select
End Sub
但我收到错误
script: D:\test.vbs
Line: 10
Char: 36
Error: Expected statement
Code: 800A0400
Source: Microsoft VBscript Compilation error
我已经将excel文件和vb文件粘贴到了D盘。谁能纠正我?