谁使用过Word或Excel中提供的宏的功能?就是关于宏的问题(比较简单)
宏可以生成VB的代码,现在我的问题是,将其生成的代码,原原本本的拷贝到
VB.NET (ASP.NET)中运行时会报错.
它产生的代码就是如下:(我估计要作稍微的修改才能运行,但不知如何修改,请赐教)
代码:
Sub Macro2()
'
' Macro2 Macro
' 宏在 2003-12-29 由 cc 录制
'
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2, NumColumns:= _
5, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
Selection.TypeText Text:="工资"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="待遇"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="超大型"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="村"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="可耕地"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="1"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="2"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="3"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="4"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="5"
End Sub