添加引用 "Scripting.FileSystemObject" (Microsoft Scripting Runtime) '用于操作文件.目录 Sub 数据整理部分() ' ' 数据整理到新的Sheet '' Dim fso As New FileSystemObject Dim folder As folder Dim file As file Dim strExt As String Dim wkb As Workbook strExt = "xlsx"
动态执行文本vba代码 Public Sub StringExecute(s As String) Dim vbComp As Object Set vbComp = ThisWorkbook.VBProject.VBComponents.Add(1) vbComp.Name = "aaa" vbComp.CodeModule.AddFromString "Sub foo" & vbCrLf & s & vbCrLf & "
From http://www.zhihu.com/question/20366713 VBA代码如下: Sub 工作薄间工作表合并() Dim FileOpen Dim X As Integer Application.ScreenUpdating = False FileOpen = Application.GetOpenFilename(FileFilter:="Microsoft Excel文件(*.xls),*.xls", MultiSelect:=True, Title:=