![]() When I click to debug, this is what comes up: (the line of code that is highlighted in the debug code window is underlined below): Private Sub Document_New()ĭim wasProtected As Boolean Dim SectionAbove As Integer 'SectionAbove = current section minus one SectionAbove = CInt(Selection.Information(wdActiveEndSectionNumber)) - 2 'See if section above was protected, and unprotect If ActiveDocument.Sections(SectionAbove).ProtectedForForms = True Then ActiveDocument.Sections(SectionAbove).ProtectedForForms = False wasProtected = True End If 'Go back one section Selection.GoTo What:=wdGoToSection, Which:=wdGoToPrevious, Count:=6 'Copy current page ActiveDocument.Bookmarks("\Page").Range.Copy 'Go forward one section Selection.GoTo What:=wdGoToSection, Which:=wdGoToNext, Count:=5 'Paste copied page Selection.Paste 'Reprotect if section was protected If wasProtected = True Then ActiveDocument.Sections(SectionAbove). When I protect the document, the error message that I get is: Run time error 5887 Command not available because document is passowrd protected. I have adjusted the section count so that it works to how the document is laid out, and runs with the correct outcome - copying the page to a new page. Hi JFK555, again, thank you for the code that you have put up here - I have tried it, and when the document is not protected it still works, copies the page above to the new page and moves the other pages down. Selection.GoTo What:=wdGoToSection, Which:=wdGoToNext, Count:=1ĪctiveDocument.Sections(SectionAbove).ProtectedForForms = True Selection.GoTo What:=wdGoToSection, Which:=wdGoToPrevious, Count:=1ĪctiveDocument.Bookmarks("\Page").Range.Copy aapko es video me btaya jayega ki kaise cover page copy page banaya jata hai MS Word m. ![]() If ActiveDocument.Sections(SectionAbove).ProtectedForForms = True ThenĪctiveDocument.Sections(SectionAbove).ProtectedForForms = False Mere YouTube channel Tally with Pradip kumar me aapka swagat hai. 'See if section above was protected, and unprotect SectionAbove = CInt(Selection.Information(wdActiveEndSectionNumber)) - 1 'SectionAbove = current section minus one The following would work in that scenario but not sure if that is what you mean. To disable add-in > File > Options > Add-ins. Head to the Insert tab and select Blank Page or Page Break. Place your cursor at the bottom of the page where you want to insert the page duplicate. ![]() Then start application normally and disable add-ins one by one and start application again every time you disable an add-in to determine the culprit add-in. Press Ctrl + C (Windows) or Command + C (Mac) to copy the entire page, or right-click the selection and select Copy. the page above) that you are trying to copy is protected meaning it can't be copied, then your code can unprotect it before you copy it. Start in Safe Mode (Hold CTRL key and click on application icon and don't release the CTRL key till it asks you for Safe mode confirmation). If you insert a section break and the section (i.e. As soon as you do so, the entirety of the document will be selected, and since this specific document is only one page, the contents of that specific page will be all that is selected. See my article on Dealing with Fields.Do you mean that the checkbox will insert a section break rather than a page break? And that the page that you then need to copy is protected? If you are using section breaks, then you need wdGoToSection rather than wdGoToPage. Instead of a Page field, you would want the following calculation field on the odd pages: braces must be generated in pairs by Word. You would want your cover page inserted using the Insert > Pages > Cover Page function. You will need headers/footers set as different even and add pages. Word will continue to see its formatted page numbers rather than those generated by the computation fields. Note that this will not work with indices nor Tables of Contents. Yes, with somewhat complex computation fields.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |