Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does the VBA code Imposition mean?

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is to share with you about the meaning of VBA code Imposition, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

ImpositionTool.bas

Attribute VB_Name = "ImpositionTool"

'folding hands (Imposition)

On the premise of considering layout and post-press processing, arrange multiple separate pages on a single sheet (arranging text, graphics, and images into one page, called page typesetting).

'print all

Sub printAll ()

Dim l_pages_count As Long, tmp_s As String

L_pages_count = Selection.Information (wdNumberOfPagesInDocument)

If l_pages_count Mod 4 > 0 Then Call setPageTo4Times

Tmp_s = getPageSequance (1, l_pages_count)

Application.PrintOut FileName:= "", Range:=wdPrintRangeOfPages, Item:= _

WdPrintDocumentContent, Copies:=1, Pages:=tmp_s, _

PageType:=wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, _

Background:=False, PrintToFile:=False, PrintZoomColumn:=2, PrintZoomRow:=1 _

, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

End Sub

'adjust the page number to a multiple of 4

'

Sub setPageTo4Times ()

Dim l_current_page As Long

Dim l_current_page2 As Long

Dim l_pages_count As Long

Dim l_tmp As Long

L_current_page = Selection.Information (wdActiveEndPageNumber)

L_pages_count = Selection.Information (wdNumberOfPagesInDocument)

L_tmp = l_pages_count Mod 4

If l_tmp > = 0 Then

Selection.EndKey Unit:=wdStory

L_current_page2 = Selection.Information (wdActiveEndPageNumber)

For I = 1 To 4-l_tmp

Selection.InsertBreak Type:=wdPageBreak

Next

ActiveDocument.ActiveWindow.PageScroll Up:= (l_current_page2-l_current_page)'+ 4-l_tmp

End If

End Sub

'return the folding page number order

Print 2 pages on both sides of a page, a total of 4 pages

'0 means a blank page needs to be printed here

Function getPageSequance (i_from As Long, i_to As Long) As String

Dim l_page_count As Long

Dim l_paper_count As Long

Dim l_p As Long, l_tmp As Long

If i_to > = i_from And i_from > 0 Then

GetPageSequance = ""

L_page_count = i_to-i_from + 1

L_paper_count = CLng (l_page_count / 4)

If l_paper_count * 4 < l_page_count Then

L_paper_count = l_paper_count + 1

End If

GetPageSequance = ""

For lumped p = 1 To l_paper_count

L_tmp = 2 * lumbp-1

If l_tmp

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report