sub dbhb()
'多表檔案合併
'把目錄下所有檔名輸入**
dim str as string
dim wb as workbook
dim sht as worksheet
str = dir("d:\data\*.*")
'可以把檔名改為"*.xls*"
for i = 1 to 100
' range("a" &i)=s=tr
' workbooks.open ("d:\data\" & str)
set wb = workbooks.open("d:\data\" & str)
'這是開啟所有檔案
for each sht in wb.sheets
wb.sheets(1).copy after:=thisworkbook.sheets(thisworkbook.sheets.count)
'把新開啟檔案內的表copy到this 當前工作表最後一張表內
thisworkbook.sheets(thisworkbook.sheets.count).name = split(wb.name, ".")(0) & sht.name
'重新命名新的表,為檔名+表名
next
wb.close
'這是把開啟的檔案關閉
str = dir
if str = "" then
exit for
'如果 str為空,退出迴圈
end if
next
end sub
多檔案的合併與分解
多檔案的合併與分解 本程式示例如何將多個檔案合併成乙個檔案,並能夠自分解。此技術在製作安裝程式時非常有用。我在本 學到了此技術,並將他整理擴充套件,能夠合併檔案和目錄,個數不限。核心程式包括乙個合併檔案類 ccombinefiles,乙個分解檔案的類 cextractfiles 和乙個表示檔案或目錄...
多檔案的合併與分解
多檔案的合併與分解 本程式示例如何將多個檔案合併成乙個檔案,並能夠自分解。此技術在製作安裝程式時非常有用。我在本 學到了此技術,並將他整理擴充套件,能夠合併檔案和目錄,個數不限。核心程式包括乙個合併檔案類 ccombinefiles,乙個分解檔案的類 cextractfiles 和乙個表示檔案或目錄...
python實現 xlsx多檔案合併
多xlsx檔案的合併,xlsx和xls檔案都可 coding utf 8 import xlrd,xlsxwriter 設定要合併的所有檔案 allxls r c users cn jupyter file test1.xlsx r c users cn jupyter file test2.xls...