PDA

View Full Version : Solved: Reset tab in footers



clhare
06-24-2008, 08:29 AM
I need to reset a tab in all footers in the document by macro. How do I change a 6.53" right tab to a 6.28" right tab?

fumei
06-24-2008, 07:20 PM
Try recording a macro to reset Tabs.

Apply it to all footers using a Footer object.

clhare
06-25-2008, 07:09 AM
Among other things, I tried the following, but it doesn't change the margins in every section. What am I doing wrong?

Sub A4LeftRightMargins()

Dim intSecCount As Integer
Dim intSection As Integer
intSecCount = ActiveDocument.Sections.Count
For intSection = 1 To intSecCount
With ActiveDocument.Sections(intSection)
' Reset margins
With Selection.PageSetup
.LeftMargin = InchesToPoints(0.89)
.RightMargin = InchesToPoints(0.89)
End With
End With
Next intSection
End Sub

clhare
06-25-2008, 08:40 AM
Oops! I attached the wrong code -- the code I attached above is to reset the margins (another attempt to solve the problem). Actually, if I can get that code to work correctly, I won't have to reset the tabs.

fumei
06-25-2008, 10:46 AM
Dim oHF As HeaderFooter
Dim oSec As Section
For Each oSec In ActiveDocument.Sections
For Each oHF In oSec.Headers
With oHF.Range.ParagraphFormat.TabStops
.ClearAll
.Add Position:=CentimetersToPoints(6.28), _
Alignment:=wdAlignTabLeft, _
Leader:=wdTabLeaderSpaces
End With
Next
Next

clhare
06-25-2008, 11:02 AM
It didn't work -- the tab didn't change in any of the footers.

fumei
06-25-2008, 12:03 PM
Works for me. Demo attached.

Scroll down so you can see the footer. There is text "Start", and it is at the existing tabstop of 8.32.

Click "Change Footer tab" on the top toolbar. It fires the code, changing the tabstop to 6.28. You can see the text "Start" move to the left - from 8.32 to 6.28.

clhare
06-26-2008, 03:39 AM
I must have had it in the wrong place in the code. I moved it and it works great! Thank you so much for your help!