G
greengrass
I would like to get some help in adding page numbers and dates (footer)
on each page when I print this workbook using the following macro. I
have a total of 22 tabs in the workbook after the macro inserts the
individual workbooks in the workbook called mybook.
If this is possible can you please show me the way?
Thanks,
'Copy a sheet from each workbook into your workbook
'This macro will copy the first sheet of each workbook into the
workbook where the code is in.
'The sheet will be named as the workbook name..
Sub TestFile3()
Dim basebook As Workbook
Dim mybook As Workbook
Dim i As Long
Application.ScreenUpdating = False
With Application.FileSearch
..NewSearch
..LookIn = "C:\Documents and Settings\Desktop\play 2006"
..SearchSubFolders = False
..FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
Set basebook = ThisWorkbook
For i = 1 To .FoundFiles.Count
Set mybook = Workbooks.Open(.FoundFiles(i))
mybook.Worksheets(1).Copy after:= _
basebook.Sheets(basebook.Sheets.Count)
ActiveSheet.Name = mybook.Name
mybook.Close
Next i
End If
End With
Application.ScreenUpdating = True
End Sub
on each page when I print this workbook using the following macro. I
have a total of 22 tabs in the workbook after the macro inserts the
individual workbooks in the workbook called mybook.
If this is possible can you please show me the way?
Thanks,
'Copy a sheet from each workbook into your workbook
'This macro will copy the first sheet of each workbook into the
workbook where the code is in.
'The sheet will be named as the workbook name..
Sub TestFile3()
Dim basebook As Workbook
Dim mybook As Workbook
Dim i As Long
Application.ScreenUpdating = False
With Application.FileSearch
..NewSearch
..LookIn = "C:\Documents and Settings\Desktop\play 2006"
..SearchSubFolders = False
..FileType = msoFileTypeExcelWorkbooks
If .Execute() > 0 Then
Set basebook = ThisWorkbook
For i = 1 To .FoundFiles.Count
Set mybook = Workbooks.Open(.FoundFiles(i))
mybook.Worksheets(1).Copy after:= _
basebook.Sheets(basebook.Sheets.Count)
ActiveSheet.Name = mybook.Name
mybook.Close
Next i
End If
End With
Application.ScreenUpdating = True
End Sub