Wizard
In word 2010 Bible, a new wizard is displayed when you create a file based on it. Then, I especially want to implement this function, such as creating several sections and creating directories.
Ran to the http://word.mvps.org to search for the next, and indeed there is a method, simply put, is in the thisdocument template project, create a document_new () process, and implement it. To put it bluntly, it is:
- Double-click thisdocument
- There are two combos at the top of the editing area opened on the right. Select the document in the box on the left. You will find that word automatically creates a document_new process.
- Add a custom form and make it a wizard.
Page settings
After the Wizard is complete, page settings are generally required. I read the Help file for half a day and learned about section. the members of pagesetup are not easy to handle. Later, they found that they only need to find an empty file, record a macro according to the page settings, and copy it.
It is worth noting that:In the last page, set the number of lines and spans on each page of the Grid. Only linespage can be set in VBA. The word calculates the span = (pageheight-topmargin-bottommargin) based on this value) /linespage. You can modify the span in the page settings, and word also responds (that is, a page may not be an integer line), but VBA cannot do this, very crashing ~~
Header and footer
The header and footer are set by section. headers and section. footers,
- Wdheaderfooterprimary: odd page
- Wdheaderfooterevenpages: Even page
- Wdheaderfooterfirstpage: Home Page
You can add a page number to the footer. The page number is represented by the field {page}. To control the page style or re-number, you need to use
- Section. footers. pagenumbers. restartnumberingatsection: whether to re-start the number in this section
- Section. footers. pagenumbers. startingnumber: Start
- Section. footers. pagenumbers. numberstyle: numbered Style
Note:: The section. footers. pagenumbers. Add method is not required to add the page number. You can directly add the page field to footers (INDEX). range.
Note:: You need to set the linktoprevious attribute of the header and footer from section 2nd. When setting the range attribute, you need to call range. Delete first, otherwise there will be the header and footer content in the previous section.
Add a directory and update a directory
Adding directories and updating directories are special. It seems difficult to directly insert and update TOC fields.
Add directory: Activedocument. tablesofcontents. Add
Update directory: Activedocument. tablesofcontents (1). Update