Vba word двусторонняя печать

When you record a macro and print using the duplex options, it does not capture duplex in the dialog.
This is the macro that was generated when I double-sided a test document:

ActivePrinter = "\MyServerMyHPPrinter"
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
        wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _
        wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
        PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
        PrintZoomPaperHeight:=0

During the recording of the Macro, the document printed duplex. When I closed/reopened the document and ran the Macro, it printed one-sided. Using Word from Office 365 and printing to HP Laser Jet9050dn. I also tried adding , ManualDuplexPrint:=False after wdPrintAllPages. This did nothing for me.

If this was formatted incorrectly, please forgive me…. this is my first post here.

title keywords f1_keywords ms.prod api_name ms.assetid ms.date ms.localizationpriority

Application.PrintOut method (Word)

vbawd10.chm158335424

vbawd10.chm158335424

word

Word.Application.PrintOut

f795218e-cd49-f3ac-c03d-9a9424361392

06/08/2017

medium

Application.PrintOut method (Word)

Prints all or part of the specified document.

Syntax

expression.PrintOut (Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)

expression Required. A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
Background Optional Variant Set to True to have the macro continue while Microsoft Word prints the document.
Append Optional Variant Set to True to append the specified document to the file name specified by the OutputFileName argument. False to overwrite the contents of OutputFileName.
Range Optional Variant The page range. Can be any WdPrintOutRange constant.
OutputFileName Optional Variant If PrintToFile is True, this argument specifies the path and file name of the output file.
From Optional Variant The starting page number when Range is set to wdPrintFromTo.
To Optional Variant The ending page number when Range is set to wdPrintFromTo.
Item Optional Variant The item to be printed. Can be any WdPrintOutItem constant.
Copies Optional Variant The number of copies to be printed.
Pages Optional Variant The page numbers and page ranges to be printed, separated by commas. For example, «2, 6-10» prints page 2 and pages 6 through 10.
PageType Optional Variant The type of pages to be printed. Can be any WdPrintOutPages constant.
PrintToFile Optional Variant True to send printer instructions to a file. Make sure to specify a file name with OutputFileName.
Collate Optional Variant When printing multiple copies of a document, True to print all pages of the document before printing the next copy.
FileName Optional Variant The path and file name of the document to be printed. If this argument is omitted, Word prints the active document. (Available only with the Application object.)
ActivePrinterMacGX Optional Variant This argument is available only in Microsoft Office Macintosh Edition. For additional information about this argument, consult the language reference Help included with Microsoft Office Macintosh Edition.
ManualDuplexPrint Optional Variant True to print a two-sided document on a printer without a duplex printing kit. If this argument is True, the PrintBackground and PrintReverse properties are ignored. Use the PrintOddPagesInAscendingOrder and PrintEvenPagesInAscendingOrder properties to control the output during manual duplex printing. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
PrintZoomColumn Optional Variant The number of pages you want Word to fit horizontally on one page. Can be 1, 2, 3, or 4. Use with the PrintZoomRow argument to print multiple pages on a single sheet.
PrintZoomRow Optional Variant The number of pages you want Word to fit vertically on one page. Can be 1, 2, or 4. Use with the PrintZoomColumn argument to print multiple pages on a single sheet.
PrintZoomPaperWidth Optional Variant The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
PrintZoomPaperHeight Optional Variant The height to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).

Example

This example prints the current page of the active document.

ActiveDocument.PrintOut Range:=wdPrintCurrentPage

This example prints all the documents in the current folder. The Dir function is used to return all file names that have the file name extension «.doc».

adoc = Dir("*.DOC") 
Do While adoc <> "" 
 Application.PrintOut FileName:=adoc 
 adoc = Dir() 
Loop

This example prints the first three pages of the document in the active window.

ActiveDocument.ActiveWindow.PrintOut _ 
 Range:=wdPrintFromTo, From:="1", To:="3"

This example prints the comments in the active document.

If ActiveDocument.Comments.Count >= 1 Then 
 ActiveDocument.PrintOut Item:=wdPrintComments 
End If

This example prints the active document, fitting six pages on each sheet.

ActiveDocument.PrintOut PrintZoomColumn:=3, _ 
 PrintZoomRow:=2

This example prints the active document at 75% of actual size.

ActiveDocument.PrintOut _ 
 PrintZoomPaperWidth:=0.75 * (8.5 * 1440), _ 
 PrintZoomPaperHeight:=0.75 * (11 * 1440)

See also

Application Object

[!includeSupport and feedback]

0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

1

07.09.2020, 23:47. Показов 5567. Ответов 19


Студворк — интернет-сервис помощи студентам

Доброго Всем!
Есть группа файлов Word (акты на одном листе)и принтер без дуплекса.
Надо эти файлы распечатать.
Хотелось (очень) бы, с помощью макроса выделив всю группу (или выделить группу и с помощью макроса), распечатать сначала нечетные страницы каждого, повернуть вручную всю кипу сразу, затем распечатать четные страницы.
Сам не умею писать коды, искал весь день подобное — не нашел, прошу помочь.



0



2630 / 1636 / 744

Регистрация: 23.03.2015

Сообщений: 5,141

08.09.2020, 09:40

2

бетон,
Вариант:
1)Создайте Temp.docx файл.
2) В него объеденить все необходимые файлы.( кодом VBA)
3) Пустить на печать ( как вам необходимо)- можно записью макроса
4) Очистить ваш Temp.docx и держать до следующих операций…



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 11:09

 [ТС]

3

Narimanych,
спасибо за интерес к проблеме, но все 4 пункта Вашего варианта самостоятельно я никогда не смогу выполнить, к сожалению, без Вашей помощи.



0



Narimanych

2630 / 1636 / 744

Регистрация: 23.03.2015

Сообщений: 5,141

08.09.2020, 11:55

4

бетон,
Как вариант попробуйте:

Кликните здесь для просмотра всего текста

Visual Basic
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
Sub MMM()
Application.ScreenUpdating = False
Set D1 = ActiveDocument
    With Application.FileDialog(msoFileDialogFilePicker)
         .AllowMultiSelect = True
         .InitialFileName = D1.Path & "*.doc*"
          If .Show = False Then Exit Sub
                       For i = 1 To .SelectedItems.Count
                            Set D2 = Documents.Open(.SelectedItems(i))
                                  D2.Range.Copy
                                   D1.Range(D1.Range.End - 1).Paste
                                   D1.Range(D1.Range.End - 1).InsertBreak Type:=0
                                   D2.Close False
                          Next
     End With
     Selection.EndKey Unit:=wdStory
 
 With D1
           .PrintOut Range:=wdPrintAllDocument, PageType:=wdPrintOddPagesOnly
                     MsgBox ("После завершения печати  на одной стороне переверните листы в принтере и нажмите ОК'")
            .PrintOut Range:=wdPrintAllDocument, PageType:=wdPrintEvenPagesOnl
           .StoryRanges(wdMainTextStory).Delete
  End With
Application.ScreenUpdating = True
 
End Sub

Файл прикрепил.Код запускается при открытии файла.

Вложения

Тип файла: rar TEMP.rar (17.7 Кб, 15 просмотров)



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 14:14

 [ТС]

5

Narimanych,
Спасибо!
прошу подсказать, как задать или создать массив файлов Word, из которого должны распечатываться эти страницы.
Это первая попытка работы с кодом в Wordе, и, если также, Вы дадите весь алгоритм решения этой задачи, то очень облегчите мои дилетантские потуги. И еще раз большое спасибо!



0



2630 / 1636 / 744

Регистрация: 23.03.2015

Сообщений: 5,141

08.09.2020, 14:35

6

бетон,
1) Открываете прикрепленный файл
2) Удерживая клавишу «SHIFT» выделяете необходимые вам вордовские файлы.
3) Нажимаете «Открыть»
4)Как появится надпись «После завершения печати на одной стороне переверните листы в принтере и нажмите ОК'» ждете , как отпечатается одна сторона
5)Переворачиваете отпечатанные листы и помещаете на вход принтера
6) Нажимаете кнопку «ОК»
7) Ждете окончания принта..

Добавлено через 9 минут
бетон,
Ну что, получилось?



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 15:33

 [ТС]

7

Narimanych,
мои действия:
1. открыл TEMP.docm
2. через разработчик запустил макрос MMM — открылось окно ОБЗОР с файлом TEMP.docm
3. выделил нужные файлы .doc — (кнопка «открыть» стала кнопкой «да») нажал кнопку «да» — снова открылся TEMP.docm ( моргнул несколько раз, но не распечатал ничего) с окном «После завершения печати на одной стороне переверните листы и нажмите ОК'»
4. нажал ОК — прежнее окно ушло, появилось другое «Run-time error ‘4608’: Значение лежит вне допустимого диапазона»
5. нажал END — окно исчезло, пошла печать, лист стал прокручиваться — на нем отображены распечатанные файлы .doc с измененными междустрочными интервалами, и число страниц стало 6 вместо 4 (начальные 2 документа были на одном листе с двух сторон.
распечатанный файл приложен.
Что я делаю не так как надо?



0



2630 / 1636 / 744

Регистрация: 23.03.2015

Сообщений: 5,141

08.09.2020, 15:42

8

бетон,

Цитата
Сообщение от бетон
Посмотреть сообщение

открыл TEMP.docm

Цитата
Сообщение от бетон
Посмотреть сообщение

через разработчик запусти

зачем?
я же писал:

Цитата
Сообщение от Narimanych
Посмотреть сообщение

Файл прикрепил.Код запускается при открытии файла.

Цитата
Сообщение от бетон
Посмотреть сообщение

выделил нужные файлы .doc

прикрепите пару( если не секрет)

Добавлено через 2 минуты
Нужно ваших 2 файла ..Для проверки. У меня работает без проблем..



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 15:56

 [ТС]

9

Narimanych,
вот они. были созданы макросами в шаблоне Word по данным из Эекселя



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 15:59

 [ТС]

10

Narimanych,

вот шаблоны Word



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 16:14

 [ТС]

11

в шаблонах присутствуют таблицы

Добавлено через 13 минут
Narimanych,
внимательно прочел пост №8

Цитата

Цитата
Сообщение от Narimanych
Посмотреть сообщение

Сообщение от Narimanych
Файл прикрепил.Код запускается при открытии файла.

обратил внимание что, код не запускается самостоятельно, а нужно дать команду из Разработчика или из Вид -Макросы



0



2630 / 1636 / 744

Регистрация: 23.03.2015

Сообщений: 5,141

08.09.2020, 17:16

12

бетон,
Переделал . Попробуйте. Инструкции те же.



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 19:24

 [ТС]

13

Narimanych,
проблем стало гораздо меньше, но, к величайшей досаде:

1. открываю файл — запускается код
2. выбираю документы на печать — на листе TEMP APDATED воспроизводятся все страницы + чистый лист —
появляется окно «После завершения печати переверните листы и нажмите ОК'»
3. нажимаю ОК — печатаются первые листы двух выбранных документов + чистый лист+вторые листы без паузы для
переворачивания листов.



0



2630 / 1636 / 744

Регистрация: 23.03.2015

Сообщений: 5,141

08.09.2020, 20:26

14

бетон,
Первые листы должны допечататься до нажатия ОК.Подождите.
У ваших файлов должно быть четное число листов…
проверял на работе с вашими файлами на 2 -х принтерах-все было без проблем.



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 20:51

 [ТС]

15

Narimanych,
пробовал с другими файлами — такая же картина
скриншот прилагаю



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 20:55

 [ТС]

16

принтер HP LaserJet M1120n MFP
Windows 7 максимальная
64-разрядная система



0



2630 / 1636 / 744

Регистрация: 23.03.2015

Сообщений: 5,141

08.09.2020, 21:22

17

бетон,
Посмотрите на свой скриншот:

Миниатюры

Двусторонняя печать разных файлов Word одновременно
 



0



2630 / 1636 / 744

Регистрация: 23.03.2015

Сообщений: 5,141

08.09.2020, 21:25

18

Вот место в коде, где сначала посылается на печать нечетная чясть листов, потом появляется мессаж и после нажатия ОК печатается четная…

With D1
.PrintOut Range:=wdPrintAllDocument, PageType:=wdPrintOddPagesOnly нечетная
MsgBox («После завершения печати переверните листы и нажмите ОК'»)
.PrintOut Range:=wdPrintAllDocument, PageType:=wdPrintEvenPagesOnly четная.
.StoryRanges(wdMainTextStory).Delete
End With

У меня на работе с вашими файлами работает.Дома — не имею возможности проверять…



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

08.09.2020, 21:46

 [ТС]

19

Narimanych,

ждал пока распечатает 3 мин — нет печати
нажал ОК мелькнуло «напечатано 2 стр» — пошла печать 2 листа — секундная задержка — 1 лист — секундная задержка — 2 листа, всего 5 листов

Добавлено через 6 минут
Narimanych,
Спасибо, что посвятили столько времени, попробую завтра на другом принтере и компе, надеюсь что получится, и сразу сообщу.



0



0 / 0 / 0

Регистрация: 16.11.2015

Сообщений: 66

10.09.2020, 17:34

 [ТС]

20

Narimanych,
День добрый,
На другом железе, как заколдовано, такая же история, и, даже, документы растягиваются на 3 страницы. Видимо — не судьба. Еще раз благодарю за проявленное внимание и затраченное время.



0



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

10.09.2020, 17:34

20

title keywords f1_keywords ms.prod api_name ms.assetid ms.date ms.localizationpriority

Window.PrintOut method (Word)

vbawd10.chm157417917

vbawd10.chm157417917

word

Word.Window.PrintOut

63ea2dd2-5b3c-1239-16ce-1b4980cde3d3

06/08/2017

medium

Window.PrintOut method (Word)

Prints all or part of the document displayed in the specified window.

Syntax

expression.PrintOut (Background, Append, Range, OutputFileName, From, To, Item, Copies, Pages, PageType, PrintToFile, Collate, FileName, ActivePrinterMacGX, ManualDuplexPrint, PrintZoomColumn, PrintZoomRow, PrintZoomPaperWidth, PrintZoomPaperHeight)

expression Required. A variable that represents a Window object.

Parameters

Name Required/Optional Data type Description
Background Optional Variant Set to True to have the macro continue while Microsoft Word prints the document.
Append Optional Variant Set to True to append the specified document to the file name specified by the OutputFileName argument. False to overwrite the contents of OutputFileName.
Range Optional Variant The page range. Can be any WdPrintOutRange constant.
OutputFileName Optional Variant If PrintToFile is True, this argument specifies the path and file name of the output file.
From Optional Variant The starting page number when Range is set to wdPrintFromTo.
To Optional Variant The ending page number when Range is set to wdPrintFromTo.
Item Optional Variant The item to be printed. Can be any WdPrintOutItem constant.
Copies Optional Variant The number of copies to be printed.
Pages Optional Variant The page numbers and page ranges to be printed, separated by commas. For example, «2, 6-10» prints page 2 and pages 6 through 10.
PageType Optional Variant The type of pages to be printed. Can be any WdPrintOutPages constant.
PrintToFile Optional Variant True to send printer instructions to a file. Make sure to specify a file name with OutputFileName.
Collate Optional Variant When printing multiple copies of a document, True to print all pages of the document before printing the next copy.
FileName Optional Variant The path and file name of the document to be printed. If this argument is omitted, Word prints the active document. (Available only with the Application object.)
ActivePrinterMacGX Optional Variant This argument is available only in Microsoft Office Macintosh Edition. For additional information about this argument, consult the language reference Help included with Microsoft Office Macintosh Edition.
ManualDuplexPrint Optional Variant True to print a two-sided document on a printer without a duplex printing kit. If this argument is True, the PrintBackground and PrintReverse properties are ignored. Use the PrintOddPagesInAscendingOrder and PrintEvenPagesInAscendingOrder properties to control the output during manual duplex printing. This argument may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
PrintZoomColumn Optional Variant The number of pages you want Word to fit horizontally on one page. Can be 1, 2, 3, or 4. Use with the PrintZoomRow argument to print multiple pages on a single sheet.
PrintZoomRow Optional Variant The number of pages you want Word to fit vertically on one page. Can be 1, 2, or 4. Use with the PrintZoomColumn argument to print multiple pages on a single sheet.
PrintZoomPaperWidth Optional Variant The width to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).
PrintZoomPaperHeight Optional Variant The height to which you want Word to scale printed pages, in twips (20 twips = 1 point; 72 points = 1 inch).

Example

This example prints the current page of the active document.

ActiveDocument.PrintOut Range:=wdPrintCurrentPage

This example prints all the documents in the current folder. The Dir function is used to return all file names that have the file name extension «.doc».

adoc = Dir("*.DOC") 
Do While adoc <> "" 
 Application.PrintOut FileName:=adoc 
 adoc = Dir() 
Loop

This example prints the first three pages of the document in the active window.

ActiveDocument.ActiveWindow.PrintOut _ 
 Range:=wdPrintFromTo, From:="1", To:="3"

This example prints the comments in the active document.

If ActiveDocument.Comments.Count >= 1 Then 
 ActiveDocument.PrintOut Item:=wdPrintComments 
End If

This example prints the active document, fitting six pages on each sheet.

ActiveDocument.PrintOut PrintZoomColumn:=3, _ 
 PrintZoomRow:=2

This example prints the active document at 75% of actual size.

ActiveDocument.PrintOut _ 
 PrintZoomPaperWidth:=0.75 * (8.5 * 1440), _ 
 PrintZoomPaperHeight:=0.75 * (11 * 1440)

See also

Window Object

[!includeSupport and feedback]

Вы не вошли. Пожалуйста, войдите или зарегистрируйтесь.

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

Сообщений [ 3 ]

1 10.09.2010 10:04:00

  • Катастрофа+3 дня. Как создать макрос двусторонней печати.
  • Vank
  • майор
  • Неактивен
  • Откуда: Екатеринбург, с Урала мы.
  • Зарегистрирован: 26.08.2010
  • Сообщений: 65
  • Поблагодарили: 2

Тема: Катастрофа+3 дня. Как создать макрос двусторонней печати.

Здравствуйте!

День назад,  мне помогли с «неразрешимой» проблемой вызова панели печати…
wordexpert.ru/forum/viewtopic.php?id=444

Макрос, я создал и даже в благодарность, его создателю  назвал им Богомолова (нет ну, а как ещё иначе?). smile

Даже вынес на ленту кнопочку, благо редактор ленты в новом W2010 это позволяет…

Но, нет в мире совершенства!

А нельзя ли создать такой макрос, что бы не вызывать панель печати, а сразу печатать с параметром двусторонняя печать?

То есть двусторонняя печать с ручной загрузкой нужна не всегда.
Есть же в этом переростке mad  W2010 кнопка «печать всего документа».
Она печатает по умолчанию односторонне. Вот и сделать такую же, но двустороннюю с ручной загрузкой…
С уважением.

Отредактировано Vank (10.09.2010 10:09:46)

Stupid is as stupid does!

2 Ответ от bogomolov 10.09.2010 14:35:16

  • bogomolov
  • сержант
  • Неактивен
  • Зарегистрирован: 28.05.2010
  • Сообщений: 16
  • Поблагодарили: 1

Re: Катастрофа+3 дня. Как создать макрос двусторонней печати.

Vank
Макросы лучше называть не фамилиями, а по их назначению.
Интересующий тебя новый макрос будет выглядеть примерно так:

Sub FilePrintDuplex()
ActiveDocument.PrintOut ManualDuplexPrint:=True
End Sub

Последний параметр, кроме True может иметь также значения PrintOddPagesInAscendingOrder и PrintEvenPagesInAscendingOrder.
Все это можно узнать самостоятельно, если воспользоваться Help’ом.
Для примера: в редакторе VBA в тексте макроса поставь курсор на слове PrintOut и нажми F1. Получишь полный перечень всех параметров  вывода на печать, в том числе и интересующего тебя дуплекса.

Отредактировано bogomolov (10.09.2010 14:35:50)

3 Ответ от Vank 14.09.2010 19:30:37

  • Катастрофа+3 дня. Как создать макрос двусторонней печати.
  • Vank
  • майор
  • Неактивен
  • Откуда: Екатеринбург, с Урала мы.
  • Зарегистрирован: 26.08.2010
  • Сообщений: 65
  • Поблагодарили: 2

Re: Катастрофа+3 дня. Как создать макрос двусторонней печати.

bogomolov пишет:

Макросы лучше называть не фамилиями, а по их назначению.

Привет!
Нууу! Не знаю!
Каково назначение ступенчатой пирамиды из полированого гранита на Красной площади?
А написано «Ленин» lol
Ну, если настаиваешь, не буду писать Макрос Богомолов Forever wink

В смысле большущее спасибо за помощь!

Stupid is as stupid does!

Сообщений [ 3 ]

Страницы 1

Чтобы отправить ответ, вы должны войти или зарегистрироваться

Похожие темы

  • макрос для печати
  • Макрос для печати страниц
  • Макрос печати для старого ПК
  • макрос для постраничной печати в WORD
  • Макрос для печати выделенного фрагмента.
  • Макрос для печати с интервалом времени
  • Макрос для быстрой печати текущей страницы
  • Помогите создать макрос.

Катастрофа+3 дня. Как создать макрос двусторонней печати.

В своей деятельности вы наверняка пользуетесь таким мощным текстовым редактором, каким является Microsoft Word. На портале о Microsoft Office Word вы узнаете про: как редактировать списки в word по алфавиту.
И, конечно, если работа с текстами в Ворде составляет значительную долю вашего труда, вам приходила в голову мысль о том, как оптимизировать ее. На портале о Microsoft Office Word вы узнаете про: разные колонтитулы на разных страницах 2007.

Этот вопрос является приоритетным на форуме Ворд Экспер, посвященном работе с различными версиями программы. На портале о Microsoft Office Word вы узнаете про: как написать в экселе число в надсрочном формате.
Форум, прежде всего, ориентирован на написание разнообразных макросов и шаблонов для Ворда. Тут есть готовые решения той или иной задачи, разбираются различные пути. Наш сайт о Microsoft Office Word даст ответ про: как убрать в ворде знак кубиков.
Вы найдете все о макросах – от самых азов для новичков, до тонкостей, которыми делятся друг с другом опытные пользователи. На портале о Microsoft Office Word вы узнаете про: как поставить ударение в indesign cs5.
В одном из подразделов форума вы можете оставить описание своей проблемы и сделать заказ на разработку макроса или шаблона. На портале о Microsoft Office Word вы узнаете про: забыла пароль от документа ворд.

Конечно, автоматизация, не единственная тема форума. Здесь обсуждаются настройки различных версий Ворда и любые другие вопросы, связанные с самой программой, редактированием, написанием, рецензированием текстов в Ворде. На портале о Microsoft Office Word вы узнаете про: как подогнать размер таблицы по ширине страницы в ворде.
Самым часто возникающим проблемам посвящен отдельный раздел, который стоит посетить в первую очередь. На портале о Microsoft Office Word вы узнаете про: настройки интерфейса окна в программе word.

Если у вас есть чем поделиться с другими пользователями Ворда, вы можете выкладывать свои решения в соответствующих подразделах. На портале о Microsoft Office Word вы узнаете про: знак абзаца в word.

RRS feed

  • Remove From My Forums
  • Question

  • Is it possible to set the ‘print both sides’ option on the new ‘File>Print’ screen in Word 2010 using VBA? I can’t use a API workaround as I don’t have the necessary permissions to change the properties of printer drivers. I have noticed that the wdDialogFilePrint
    has a DuplexPrint argument, but I can’t make it work

All replies

  • Hi HileTroy,

    Thanks for posting in the MSDN Forum.

    It’s based on my experience that what you are looking for is the
    Document.PrintOut Method . Set the ManualDuplexPrint variable to
    true to print a two-sided document on a printer without a duplex printing kit.

    Also, take a look at this article.

    HOWTO: Set Duplex Printing for Word Automation

    Hope this can help you.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

  • That’s not exactly what I was after, I know how to set manual duplex, but the printer I’m sending the documents to is a duplex printer. What I’m trying to do is set real duplex so the user doesn’t have to turn the paper over and reload it. What I want
    is for the macro I am writing to set the number of copies (done that, not a problem), set black-and-white or colour(also not a problem) and set duplex printing (problem) and for all this to happen in the background with no further user input or action.

  • Hi HileTroy,

    I will involve some experts who are familiar with this issue, and it may take some time. Much appreciate for your patience.

    Best Regards,


    Leo_Gao [MSFT]
    MSDN Community Support | Feedback to us

  • Hi HileTrov

    I have a couple of questions for clarification:

    1. You mention that you don’t have the necessary permissions to change the printer properties. Are you talking about changing the default settings under Control Panel Printer or even setting properties for the current document?
    2. If you go to File Print do you have the option(s) for «Print on Both Sides» (if you do you probably have one for «Flip pages on the long edge» and one for «Flip pages on the short edge»).
    3. Assuming you do have these option, if you manually choose one and print does it print duplex?

    Duplex is a printer setting and is not exposed via the Word object model. That being said if you can successfully print in duplex mode from the «File Print» screen then you should be able to see the duplex property as described the article below.

    HOWTO: Set Duplex Printing for Word Automation
    http://support.microsoft.com/kb/230743?wa=wsignin1.0

    Best Regards,

    Donald M.
    Microsoft Online Community Support
    ———————————————————————————
    Please remember to click «Mark as Answer» on the post that helps you, and to click «Unmark as Answer» if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Hi Donald,

    Thanks for posting the HowTo doc. This works perfectly in Word 2007, but I cannot make it work in Word 2010 and 2013. The macro is unable to read settings from the printer.

    Do you know what has changed in Word 2010 since this isn’t working anymore? I’ve seen posts from other folks having the same problem…

    Also, as a workaround I have tried to use:

    Dialogs(wdDialogFilePrint).DuplexPrint = True

    …however that also doesn’t work. 

    Any advise would be most appreciated!

    Thanks!

    Fredo

  • Hello,

    I join the conversation and I hope it is not too late.

    I have exactly the same problem as Fredo: I used the example given in
    HOWTO: Set Duplex Printingfor Word Automation
    but it didn’t work.

    To make it print, I replaced Printer. DeviceName by Printer (and before that, I wrote
    Printer = Application. ActivePrinter and that worked fine).

    Finally, I obtain 2 pages with «This is on page 1», «This is on page 2» but not in duplex (on separate sheets of paper).

    I hope you can help me, thanks !

Понравилась статья? Поделить с друзьями:
  • Vba word высота таблицы
  • Vba word range words
  • Vba word выровнять по центру
  • Vba word range select
  • Vba word выпадающий список