seamoon
09-04-2013, 12:52 PM
I have a script that do various fixes including converting footnotes to endnotes, the script works fine when document has a footnote but if document has no footnote then I get script error it highlights the string "ActiveWindow.View.SeekView = wdSeekFootnotes"
I guess the script needs additional If section when there's no footnotes Then skip and continue to rest of the script. How can I do this?
...
ActiveWindow.ActivePane.DisplayRulers = Not ActiveWindow.ActivePane. _
DisplayRulers
Selection.WholeStory
Selection.Font.Bold = wdToggle
Selection.Font.Bold = wdToggle
Options.DefaultHighlightColorIndex = wdNoHighlight
Selection.Range.HighlightColorIndex = wdNoHighlight
Selection.Font.Color = wdColorAutomatic
Selection.ClearFormatting
Selection.ClearFormatting
Selection.Font.Size = 12
Selection.Font.Name = "Tahoma"
ActiveWindow.View.Type = wdWebView
End With
If ActiveWindow.ActivePane.View.Type = wdPrintView Or ActiveWindow. _
ActivePane.View.Type = wdWebView Or ActiveWindow.ActivePane.View.Type = _
wdPrintPreview Then
ActiveWindow.View.SeekView = wdSeekFootnotes
Else
ActiveWindow.View.SplitSpecial = wdPaneFootnotes
End If
Selection.WholeStory
If Selection.StoryType = wdFootnotesStory Then
Selection.Footnotes.Convert
Else
Selection.Endnotes.Convert
End If
Selection.WholeStory
Selection.Font.Name = "Tahoma"
Selection.Font.Size = 12
Selection.Font.Bold = wdToggle
Selection.Font.Bold = wdToggle
Selection.Font.Italic = wdToggle
Selection.Font.Italic = wdToggle
With Selection.ParagraphFormat
.RightIndent = InchesToPoints(0)
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceAtLeast
.LineSpacing = 2
.Alignment = wdAlignParagraphLeft
.WidowControl = False
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.NoLineNumber = False
.Hyphenation = True
.OutlineLevel = wdOutlineLevelBodyText
.CharacterUnitRightIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
End With
I guess the script needs additional If section when there's no footnotes Then skip and continue to rest of the script. How can I do this?
...
ActiveWindow.ActivePane.DisplayRulers = Not ActiveWindow.ActivePane. _
DisplayRulers
Selection.WholeStory
Selection.Font.Bold = wdToggle
Selection.Font.Bold = wdToggle
Options.DefaultHighlightColorIndex = wdNoHighlight
Selection.Range.HighlightColorIndex = wdNoHighlight
Selection.Font.Color = wdColorAutomatic
Selection.ClearFormatting
Selection.ClearFormatting
Selection.Font.Size = 12
Selection.Font.Name = "Tahoma"
ActiveWindow.View.Type = wdWebView
End With
If ActiveWindow.ActivePane.View.Type = wdPrintView Or ActiveWindow. _
ActivePane.View.Type = wdWebView Or ActiveWindow.ActivePane.View.Type = _
wdPrintPreview Then
ActiveWindow.View.SeekView = wdSeekFootnotes
Else
ActiveWindow.View.SplitSpecial = wdPaneFootnotes
End If
Selection.WholeStory
If Selection.StoryType = wdFootnotesStory Then
Selection.Footnotes.Convert
Else
Selection.Endnotes.Convert
End If
Selection.WholeStory
Selection.Font.Name = "Tahoma"
Selection.Font.Size = 12
Selection.Font.Bold = wdToggle
Selection.Font.Bold = wdToggle
Selection.Font.Italic = wdToggle
Selection.Font.Italic = wdToggle
With Selection.ParagraphFormat
.RightIndent = InchesToPoints(0)
.SpaceBefore = 0
.SpaceBeforeAuto = False
.SpaceAfter = 0
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceAtLeast
.LineSpacing = 2
.Alignment = wdAlignParagraphLeft
.WidowControl = False
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.NoLineNumber = False
.Hyphenation = True
.OutlineLevel = wdOutlineLevelBodyText
.CharacterUnitRightIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
End With