C
Cissy
Hi,
Very strange, but I get a "VALUE OUT OF RANGE" error when I run the
following macro, only when I have my Balloons on (Reviewing toolbar, Show,
Options, Balloons). I've tried everything I know, any ideas would be
appreciated. Happy Holidays!
Sub StampinFooter()
If Documents.Count = 0 Then Exit Sub
MACRO STOPS AND GIVES ERROR FOR THE FOLLOWING LINE:
If Selection.PageSetup.DifferentFirstPageHeaderFooter = True Then
Selection.EndKey unit:=wdStory
Selection.InsertBreak Type:=wdPageBreak
Call DeleteFooters 'scrubs footers in all sections
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME \* Lower ", PreserveFormatting:=True
Selection.HomeKey unit:=wdLine, Extend:=wdExtend
With Selection.Font
.Name = "Times New Roman"
.Size = 8
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
.Animation = wdAnimationNone
End With
Selection.Fields.Locked = True
Selection.WholeStory
Selection.Copy
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.EndKey unit:=wdStory
Selection.TypeBackspace
Selection.HomeKey unit:=wdStory
'ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
ActiveWindow.ActivePane.View.SeekView = wdSeekFirstPageFooter
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeBackspace
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Call DeleteFooters
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"FILENAME \* Lower ", PreserveFormatting:=True
Selection.HomeKey unit:=wdLine, Extend:=wdExtend
With Selection.Font
.Name = "Times New Roman"
.Size = 8
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
.Animation = wdAnimationNone
End With
Selection.Fields.Locked = True
' Selection.HeaderFooter.PageNumbers.Add PageNumberAlignment:= _
' wdAlignPageNumberCenter, FirstPage:=False
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Application.Browser.Target = wdBrowsePage
Application.Browser.Next
Selection.HomeKey unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Forward = True
End With
Selection.Find.Execute
Selection.HomeKey unit:=wdStory
End If
End Sub
Very strange, but I get a "VALUE OUT OF RANGE" error when I run the
following macro, only when I have my Balloons on (Reviewing toolbar, Show,
Options, Balloons). I've tried everything I know, any ideas would be
appreciated. Happy Holidays!
Sub StampinFooter()
If Documents.Count = 0 Then Exit Sub
MACRO STOPS AND GIVES ERROR FOR THE FOLLOWING LINE:
If Selection.PageSetup.DifferentFirstPageHeaderFooter = True Then
Selection.EndKey unit:=wdStory
Selection.InsertBreak Type:=wdPageBreak
Call DeleteFooters 'scrubs footers in all sections
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"FILENAME \* Lower ", PreserveFormatting:=True
Selection.HomeKey unit:=wdLine, Extend:=wdExtend
With Selection.Font
.Name = "Times New Roman"
.Size = 8
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
.Animation = wdAnimationNone
End With
Selection.Fields.Locked = True
Selection.WholeStory
Selection.Copy
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Selection.EndKey unit:=wdStory
Selection.TypeBackspace
Selection.HomeKey unit:=wdStory
'ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
ActiveWindow.ActivePane.View.SeekView = wdSeekFirstPageFooter
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeBackspace
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Call DeleteFooters
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:= _
"FILENAME \* Lower ", PreserveFormatting:=True
Selection.HomeKey unit:=wdLine, Extend:=wdExtend
With Selection.Font
.Name = "Times New Roman"
.Size = 8
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
.Animation = wdAnimationNone
End With
Selection.Fields.Locked = True
' Selection.HeaderFooter.PageNumbers.Add PageNumberAlignment:= _
' wdAlignPageNumberCenter, FirstPage:=False
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Application.Browser.Target = wdBrowsePage
Application.Browser.Next
Selection.HomeKey unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.Forward = True
End With
Selection.Find.Execute
Selection.HomeKey unit:=wdStory
End If
End Sub