想在合并Excel表之前,在表中先运行录制好的宏代码,并保存该工作簿.这代码应怎样写?
Dim dlg As New OpenFileDialog
dlg.InitialDirectory = "E:\"
dlg.Filter = "Excel文件|*.xls"
dlg.MultiSelect = True '允许选择多个文件
If dlg.ShowDialog =DialogResult.OK Then
For Each fl As String In dlg.FileNames
Dim App As New MSExcel.Application
Dim Wb As MSExcel.Workbook = App.WorkBooks.Open(""& fl & "") '第一个Excel文件
Dim Wd As MSExcel.Window = Wb.Windows(1) '表示当前工作簿窗口
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1) '第一个工作表
App.Visible = True
'运行宏"Macro1" 这段代码应怎么写?
'保存文件
Next
End If
用"Sub Macro1() "根本不行.
[此贴子已经被作者于2013-10-13 20:48:41编辑过]