Continue page numbering from a specific section in MS Word? - vba

How does one continue the page numbering from a specific section in MS Word?
Consider the following scenario:
MS Word document with 3 sections A, B, and C.
Page numbering starts at 1 on the first page of section A (ends at, let's say, 3, on page 3).
No page numbering (or alternate page numbering) in section B.
In section C, page numbering continues from that of section A (first page-number of section C is <last_page_A> + 1 = 4).
Now let the number pages in section A, B, and C vary and the page numbering
to automatically adapt. The document has a Table of Contents.
Is this possible using the MS Word GUI through some trickery I am not aware of? If not, how could one do this with MS Office Field Codes or VBA?
To my knowledge, the MS Word GUI only lets you continue page numbering from the previous section, or alternatively, lets you manually handle the page numberings:

To insert a page number cross-reference, follow these steps:
Insert a bookmark on the page containing the information you want to cross-reference.
Position the insertion point where you want the cross-reference to occur.
Press Ctrl+F9 to insert field brackets. Make sure the insertion point stays between the brackets.
Type pageref followed by the bookmark name used in step 1.
Press F9 to update the field information.
Please refer to the following link:
Inserting Page Number Cross-References
Controlling the Format of Cross-References

Related

Microsoft Word Page Numbering Part-Section-Page

I have a long document with about 9 Parts and each part contains 2 - 5 sections. I want to have my page numbers read Part-Section-Page. For example, page 5 of section 4 in part 3 would have the page number 3-4-5.
Using this field code I can output this correct page number in my footer
{STYLEREF 1 \s}-{STYLEREF 2 \s}-{PAGE}
This works because the first field code outputs the current Part, signified by Header 1, the 2nd code outputs the section number signified by Header 2, and then last output is the page which I can control with section breaks.
BUT - This is no help with the Table of Contents! When the ToC is generated, Word only recognizes {PAGE} as the page number, and therefore I need to manually write the ToC.
Is there any way to make the page number actually be in the format x-y-x?
Any ideas or help would be appreciated!

MS-Word - Pulling down cell content to the next page if a table is broken by a page-break

I have a table in Word that has column titles. When the page breaks the table rolls over to the next page and the headers repeat. However, I also have section titles that are important to see as well. If you look at the example below, I have the section '2' at the top next to sub-section 'C'.
a) I will be generating MHTML dynamically for import into Word so if it is possible to generate MHTML that will enable the above then that would be great. Otherwise ...
b) Is there any way within Word to manually or using VBA mark up the sections so they know to roll over to the next page automatically, so that the table will update itself if there are any changes to page-break locations. Alternatively...
c) I might have to write some VBA that checks that the section numbers are in the right place every time the VBA code is manually run, although I suspect that might start to get messy as I will also have to remove any existing 'pulled' section numbers that might have been inserted.
Thanks

Unable to extract and re-insert MS Word Content Control using VBA and InsertXML

This question is related to my other question: Range.InsertXML using Transform
In MS Word it is easy to insert a content control using VBA, for example:
ThisDocument.ContentControls.Add wdContentControlRichText, Selection.Range
I've recently started exploring more in the XML side of things, e.g.:
Debug.Print ThisDocument.Range.XML seems to (or actually does) produce the XML for a Word document. However, if I create a NEW, BLANK document and add a Content Control I am unable to extract and reinsert the Content Control (oCC).
My steps:
added 2 blank paragraphs to a new document
added oCC to the 2nd paragraph
selected the oCC paragraph
immediate window: thisdocument.Paragraphs(1).Range.InsertXML selection.Range.XML
At first glance it LOOKS like the Content Control was duplicated, BUT on closer inspection, it was deleted and only the formatted text remains (see image, top paragraph is actually just formatted text).
Thinking I could out smart MS Word I set the properties of the Content Control to '...can not be deleted', but that didn't help.
I've also tried to insert into a separate document in case the issue had something to do with duplication of something that ought to have been unique.
In a nutshell:
To answer this question I need a way to insert a Content Control to a document using a combination of VBA and XML (or confirmation that what I am attempting is not possible).
Just realized I should use Selection.Range.WordOpenXML instead of Selection.Range.XML

Replace a blank before a table page break Word VBA

I uncheck "Allow row to break across pages" for a table's properties So, the table is shown on a new page to ensure that all the content is on one page, this works fine. But Word generates a blank space before the page break, I need to replace it with some text for a legal reason. I can't use a watermark or shapes because un Oracle BI Publisher only prints it on PDF and I need to export it to a docx.
The data is dynamic, so sometimes the text before the table and the text inside the table may change.
Current Version https://imgur.com/a/FTx0q
I need some like this https://imgur.com/a/ySitL
MS Office support told me that it can't be done with Word...
Maybe with VBA code?
Update
Thanks Cindy for your help.
I have a table into another table many paragraphs, checkbox etc and they are fitting on a new page. It's working.
I understand there isn't a page break.
It's Paragraph mark.
But what I need to do is insert a kind of mark, a text like XXXX,-----------, Instead of leaving "free space",
It's a requirement not change the font size or another text format.
For a legal requirement, some paragraph must fit on a new page and "blank spaces" replaced by a kind of mark.
I can't hard code it because in several cases not all the paragraphs or section in a page will be shown and I don't know by default when a new page is needed.
I am available to use macros or anything.
What you could do is insert a page-size table into a textbox in the page header and format the body text with a white background. The table will thus be hidden behind any text on the page, but not otherwise (provided you don't pad unused space with empty paragraphs, etc.).

Word / PDF - Merge Documents

I am looking to merge two documents, however it is not your typical merge.
My first document is a mailmerge, creating a cover letter, basically each page has a name and address
My next document is a static document that cannot be changed.
I need to insert the static document into my first merged document, but after every page, therefore, for every one page a document is inserted.
I have tried the insert document in both word 2010 and pdf using adobe acrobat, and as you have thought it only inserted one document after the first page.
I'm looking at VBA, but I have never utilized VBA and word before
Any pointers would be appreciated.
Many thanks
I should have spent more time on this.
The original template contains fields to merge.
On the static document that I mention, click insert tab, Text Section, select Object - Text From File
Select the cover letter / template that contains the fields to merge. This will insert the template followed by the static document that cannot be changed
Note I have spotted some formatting changes on the template following merge - further work required
From this point start your mail merge, and complete merge to Adobe or word.
This creates a mail merged document containing the cover letter with name and address fields followed by the static document.
Extremely simple. I always over complicate things!
I'll work on the changed formatting, but other then that this works