|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub CommandButton1_Click()
Dim MyPath$, MyName$, wb As Workbook, sh As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
MyPath = ThisWorkbook.Path & "\"
MyName = Dir(MyPath & "*.xlsx")
With ThisWorkbook.Sheets
Do While MyName <> ""
If InStr(MyName, ThisWorkbook.Name) = 0 Then
Set wb = GetObject(MyPath & MyName)
s = Split(MyName, ".")(0)
wb.Sheets("预算会计--序时账").Copy After:=.Item("首")
ActiveSheet.Name = s
wb.Close False
End If
MyName = Dir
Loop
End With
Application.ScreenUpdating = False
MsgBox "ok"
End Sub
请教各位大神,我这个代码 是为了将其他工作簿的表格进行提取的一个工作簿上,就是现在xlsx格式可以提取,就是标红处代码如何修改,可以将xlsm格式的也提取了。
附件已上传,谢谢各位大神指导
|
|