如何执行EXCEL的宏?
我已成功建立EXCEL对象并在单元格填入了"abcde"
oleobject newoleobj,newoleworkbooks
newoleobj=create oleobject
if newoleobj.connecttonewobject("excel.application")<>0 then
messagebox("?","oleFAil!")
return
else
messagebox("ok","olesuccess!")
end if
newoleobj.workbooks.add
newoleobj.visible=true
newoleworkbooks=newoleobj.worksheets(1)
newoleworkbooks.cells(1,1).value = "abcde"
现在有如下宏如何执行?(如VB下直接使用即可).
Sub 宏1()
'
' 宏1 Macro
' kjgs 记录的宏 2005-3-21
'
'
Range("A1:B3").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub