Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 5473|回复: 2

[已解决]word用VBA增加多页空白页?

[复制链接]
发表于 2017-6-11 10:31 | 显示全部楼层 |阅读模式
word用VBA增加多页空白的页面,我在网上找了一个,但一次只能增加一页,我想每次点击按钮时,出现对话框,然后自己输入多页,确定后就再增加多少页?谢谢各位帮忙!
最佳答案
2017-6-11 12:22
Sub InserNewPage()
Dim i As Integer, pg As Integer
pg = InputBox("请输入插入空白页数量", "插入页提示")
If i >= pg Then Exit Sub
    For i = 1 To pg
        Selection.EndKey Unit:=wdStory
        Selection.InsertBreak Type:=wdPageBreak
        'Selection.TypeText Text:="New Page"
    Next
End Sub可以套循环啊

设置空白页并加页码.rar

6 KB, 下载次数: 20

发表于 2017-6-11 12:22 | 显示全部楼层    本楼为最佳答案   
Sub InserNewPage()
Dim i As Integer, pg As Integer
pg = InputBox("请输入插入空白页数量", "插入页提示")
If i >= pg Then Exit Sub
    For i = 1 To pg
        Selection.EndKey Unit:=wdStory
        Selection.InsertBreak Type:=wdPageBreak
        'Selection.TypeText Text:="New Page"
    Next
End Sub可以套循环啊
回复

使用道具 举报

 楼主| 发表于 2017-6-11 15:11 | 显示全部楼层
苏子龙 发表于 2017-6-11 12:22
Sub InserNewPage()
Dim i As Integer, pg As Integer
pg = InputBox("请输入插入空白页数量", "插入页提 ...

谢谢老师
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-4-25 17:43 , Processed in 0.816238 second(s), 12 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表