Sub Macro1() ' ' Macro1 Macro 'Workbooks.Open Filename:= _ '"C:Documents and Settingsanmin.fu桌面FX12、长期应收款0.xls"
Dim inbook As String 'Dim insheet As String Dim i As Integer 'Dim EachSheet As Worksheet 'Dim outbook As String 'Dim outsheet1 As String 'Dim outsheet2 As String
'Create Excel file that as the book name and sheet name 'specify the input fileslist and out put file and out sheet. 'outbook = "Tahe-HtSta.xls" 'outsheet1 = "Tahe-HtSta" 'outsheet2 = "Tahe-treeNumSta" For i = 1 To 306 '需更改数目与filelist中的个数一致 '指定输入文件book和Sheet inbook = Workbooks("filelist.xls").Worksheets("filelist").Cells(i, 1).Value inbook1 = Workbooks("filelist.xls").Worksheets("filelist").Cells(i, 2).Value Workbooks.Open Filename:=inbook '_ '"C:Documents and Settingsanmin.fu桌面FX" & inbook '指定输入文件的路径+文件名 For Each EachSheet In ThisWorkbook.Sheets 'EachSheet.PageSetup.RightFooter = "页脚文字插入当前日期:" & Format(Date, "yyyy年m月d日") EachSheet.PageSetup.CenterHeader = "" EachSheet.PageSetup.LeftHeader = _ "&""Times New Roman,Bold Italic""&12ICPAs&""Times New Roman,Regular""" & "&""方正舒体,Bold""中泓应泰会计师事务所" EachSheet.PageSetup.RightHeader = "" Next EachSheet Workbooks(inbook1).Save Workbooks(inbook1).Close Next i