为什么我调用excel中的宏没有反应
以下是程序中的调用函数
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRng As Excel.Range
oXL = CreateObject("Excel.Application")
oXL.Visible = True
oWB = oXL.Workbooks.Open("C:\Documents and Settings\Administrator\桌面\资料文件夹\44.xls")
oSheet = oWB.Worksheets(1)
oSheet.Cells(1, 1) = "444"
oXL.Run("Macro1()") ‘这条语句没有错吧,但是执行完后没有反映
oWB.Close(True)
oXL.Quit()
End Sub
以下是我录制的宏
Sub Macro1()
'
' Macro1 Macro
' 宏由 MC SYSTEM 录制,时间: 2006-8-24
'
'
Range("D2").Select
With Selection.Borders(xlDiagonalDown)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlDiagonalUp)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
End Sub
到底问题出在那啊。我都弄了好几天了也没弄明白。各位高手帮忙啊