Deleting Section Break and rest of document loses header
I sort of understand this - that the header info is stored in the section break. But I have not been able to get this quite right in a macro. Let me explain what I am trying to do first:
- template has 2 sections (and only 2 pages); header is different in each; footer is the same
- user sometimes want to delete the second page and so I have put a macro button to do this
- when this happens, I want the first page header to remain as it is
Here is my macro. Feel free to suggest any changes as I am just trying to simplify code that was pulled from the macro recorder. I have used ranges before and have used a lot of the collections so if that is a better way to do it, please suggest.
' go to the start of the 2nd section
.GoTo What:=wdGoToSection, Which:=wdGoToFirst, Count:=2
' make sure we are on Print view; should always be but just in case
If .View.Type = wdNormalView Or .View.Type = wdOutlineView Then
.View.Type = wdPrintView
' get into the header area
.View.SeekView = wdSeekCurrentPageHeader
' link to previous section; it was previous False as the section headers were different; by linking, the
' 2nd section inherits the first section's header; debug: have to then toggle again because it seems when
' we delete the 2nd section, the first section loses it's header altogether
Selection.HeaderFooter.LinkToPrevious = True
Selection.HeaderFooter.LinkToPrevious = False
' in the case of the footer, they are currently the same so we have to "break" the linkage because otherwise,
' in testing, found that we lost our McKellar logo that is in the 1st section footer
.View.SeekView = wdSeekCurrentPageFooter
Selection.HeaderFooter.LinkToPrevious = False
' return to the main view
.View.SeekView = wdSeekMainDocument
' move back 1 char before the Section break so that when we extend the selection, it includes the section
' break; then extend the selection to the end of the doc in prep for deleting
.Move Unit:=wdCharacter, Count:=-1
.EndKey Unit:=wdStory, Extend:=wdExtend
' delete the selection
' go back to the top of the document
End With ' for With Selection
Solutions to the Problem Deleting Section Break and rest of document loses header
Do you really need two sections? Or could you accomplish the same thing using "Different First Page"? This allows you to have different headers and footers on the first and subsequent pages, and deleting a second page has no effect on the header/footer
of the first page.
Open Action Center by clicking the Start button Picture of the Start button, clicking Control Panel, and then, under System and Security, clicking Review your computer's status.
Make sure your computer has at least the minimum amount of random access memory (RAM) required to run the program that is displaying the error. Look for the program requirements online or in the packaging information.
Recommended Method to Repair the Problem: Deleting Section Break and rest of document loses header:
How to Fix Deleting Section Break and rest of document loses header with SmartPCFixer?
1. Click the button to download SmartPCFixer . Install it on your system. Open it, and it will perform a scan for your computer. The junk files will be shown in the scan result.
2. After the scan is finished, you can see the errors and problems need to be fixed. Click Fix All.
3. When the Fixing part is finished, your computer has been speeded up and the errors have been removed
Related: How to Update & Download NVidia GeForce 6100/nForce 420 WHQL Certified driver v.178.13,How to Update & Download NVidia GeForce 7600 GS Video Driver v.295.75 Certified,How Can I Update & Download NVidia GeForce 820M Driver v.344.48 WHQL,[Solved] Download NVidia GeForce GTX 560M VGA Driver v.296.17 Certified,Way to Update & Herunterladen NVidia GeForce GT 130M Video Treiber v.295.75 Certified,How to Update & Download SONY SVE14A1X1RH Realtek Ethernet Driver,Where to Download SONY SVS13A2W9ES Bluetooth Driver (Intel) v.2.6 - 22.214.171.124059,Best Way to Update & Download SONY VGN-CR203E Conexant HDAUDIO SoftV92 Data Fax Modem with SmartCP Setup Program v.126.96.36.199 driver,Best Way to Download SONY VGN-FE790G/N Wireless LAN Driver v.10.6.0.29,Method to Update & Download SONY VGN-NR31Z/S Firmware Extension Parser Device v.188.8.131.52,How to Fix Error 0x0000c1f5 Solución?,Error 0x80071a91 Win7 Fix Patch,Error 0x800ccc60 Windows Live Mail [Solved],Error Message 0x800ccc79 Outlook 2000 Fix,What is Error 0xc1ab0001?,[Answered] x64 saplugin dll,How to Fix Problem - Kb943729 Download?,Troubleshooting: Bccode D1 Error,Java Runtime Tech Support,Troubleshooting: ERROR NO SUCH GROUP Error
Read More: Solution to Error: daily disk cleanup option? how do you stop this?,deleted files stay in folder until refresh [Solved],Troubleshoot:desk top icons stopped responding also task bar icons,Solution to Problem: Delta search. How do I get rid of it,How to Fix - Data Validation - Pasting a list while sheet is protected?