powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Microsoft Office [игнор отключен] [закрыт для гостей] / печать определенных листов из множества книг
1 сообщений из 1, страница 1 из 1
печать определенных листов из множества книг
    #33933257
Фотография Ivan33
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
печать определенных листов из множества книг

Printing Selected Worksheets
авторSummary: Need to print just a few worksheets out of a group of workbooks? There’s no need to manually load each workbook and print the sheets; instead you can use the macro presented in this tip. It allows you to print selected worksheets from each workbook in a particular folder. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 2003.)

авторIf you have a lot of workbooks that have accumulated over the years, you may have a need to print some of the worksheets out of each of them. For instance, you may need to print the second and third worksheets out of each workbook in a folder. Loading each workbook and then printing selected sheets could take a huge amount of time.

A quicker way is to create a macro that will do the printing for you. The following macro starts by asking you for a directory path. Provided that you specify a path, the macro then starts to load each XLS (Excel) file in the directory, and then print the second and third worksheet from each one. Once printed, the worksheet is closed.

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
Public Sub PrintWorkbooks()
    Dim sCurFile As String
    Dim sPath As String

    'Get the path
    sPath = InputBox("Starting path?", "PrintWorkbooks")
    If sPath <> "" Then
        On Error Resume Next
        Application.ScreenUpdating = False
        If Right(sPath,  1 ) <> "\" Then
            sPath = sPath & "\"
        End If
        sCurFile = Dir(sPath & "*.xls", vbNormal)
        Do While Len(sCurFile) <>  0 
            Workbooks.Open sPath & sCurFile, , True
            With Workbooks(sCurFile)
                .Worksheets( 2 ).PrintOut
                .Worksheets( 3 ).PrintOut
                .Close SaveChanges:=False
            End With
            sCurFile = Dir
            DoEvents
        Loop
        Application.ScreenUpdating = True
        On Error GoTo  0 
    End If
End Sub
авторObviously, if you have quite a few workbooks in the directory, printing could take quite some time. You may want to find some time when you have nothing else to do, and then just let the macro start running.

статья на вынос (см. внизу)

савэт с - http://exceltips.vitalnews.com/Pages/T0295_Printing_Selected_Worksheets.html
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / Microsoft Office [игнор отключен] [закрыт для гостей] / печать определенных листов из множества книг
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]