View Single Post
 
Old 12-14-2012, 02:51 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,374
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi mbk,

Using your code in Word 2003 and 2010, I'm unable to reproduce a run-time 4605 error unless the selection is somewhere other than where an endnote legitimately can be inserted.

The absence of some descriptive text in the first error message is disconcerting - and it makes troubleshooting rather difficult. I've tweaked the code somewhat, but I'm not sure that'll resolve the problem:
Code:
Sub InsertEndnote()
With Selection
  If .StoryType <> wdMainTextStory Then Exit Sub
  .Start = .Words.Last.Start
  .End = .Words.Last.End
  If .Characters.Last = " " Then .End = .End - 1
  .Collapse wdCollapseEnd
  .Endnotes.Add Range:=.Range
  With .EndnoteOptions
    If .Location <> wdEndOfDocument Then .Location = wdEndOfDocument
    If .NumberingRule <> wdRestartContinuous Then .NumberingRule = wdRestartContinuous
    If .StartingNumber <> 1 Then .StartingNumber = 1
    If .NumberStyle <> wdNoteNumberStyleArabic Then .NumberStyle = wdNoteNumberStyleArabic
  End With
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote