Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-13-2012, 07:18 AM
mbk mbk is offline Error on macro to insert endnotes on Mac Mac OS X Error on macro to insert endnotes on Mac Office for Mac 2011
Novice
Error on macro to insert endnotes on Mac
 
Join Date: Dec 2012
Posts: 6
mbk is on a distinguished road
Default Error on macro to insert endnotes on Mac

I use Word 14.2.3 for Mac under OS X 10.7.5 (Lion). I want a macro that inserts an endnote into a Word document, using Arabic numbering. I recorded such a macro, but when I run it keep getting Run-time error '4605' .
Help, anyone?



Here is the code:
Code:
Sub InsertEndnote()
'
' InsertEndnote Macro
'
'
With Selection
  With .EndnoteOptions
    .Location = wdEndOfDocument
    .NumberingRule = wdRestartContinuous
    .StartingNumber = 1
    .NumberStyle = wdNoteNumberStyleArabic
  End With
  .Endnotes.Add Range:=Selection.Range, Reference:=""
End With
End Sub

Last edited by macropod; 12-13-2012 at 05:54 PM. Reason: Added code tags & formatting
Reply With Quote
  #2  
Old 12-13-2012, 06:06 PM
macropod's Avatar
macropod macropod is offline Error on macro to insert endnotes on Mac Windows 7 64bit Error on macro to insert endnotes on Mac Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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,

That error suggests you're trying to run the macro when the selection is somewhere other than in the body of the document (eg a textbox, header or footer - where you can't insert an endnote). What does the rest of the error message say?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-14-2012, 01:56 AM
mbk mbk is offline Error on macro to insert endnotes on Mac Mac OS X Error on macro to insert endnotes on Mac Office for Mac 2011
Novice
Error on macro to insert endnotes on Mac
 
Join Date: Dec 2012
Posts: 6
mbk is on a distinguished road
Default Error message meaningless

Dear Paul:
Thanks for your prompt reply.
The full error message is as follows. Text in < > is comment from me.
------------------------------------------------
Run-time error '4605':

The

Continue <Greyed-out button> End Debug Help
--------------------------------------------------
This error occurs independent of where the focus (cursor) is. It happens at the beginning, in the middle and at the end of text, or in a new blank document.
I do not use headers or footers in documents. However, when I create a header and put the cursor in the header the error message runs:

------------------------------------------------
Run-time error '4605':

This method or property is not available because the object refers to a header or footer.

Continue <Greyed-out button> End Debug Help
--------------------------------------------------
So being in a header does make a difference.
Reply With Quote
  #4  
Old 12-14-2012, 02:51 AM
macropod's Avatar
macropod macropod is offline Error on macro to insert endnotes on Mac Windows 7 64bit Error on macro to insert endnotes on Mac Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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
  #5  
Old 12-14-2012, 10:46 AM
mbk mbk is offline Error on macro to insert endnotes on Mac Mac OS X Error on macro to insert endnotes on Mac Office for Mac 2011
Novice
Error on macro to insert endnotes on Mac
 
Join Date: Dec 2012
Posts: 6
mbk is on a distinguished road
Default Is it a Mac problem?

Dear Paul:

You said the code runs OK in Word 2003 and 2010. Is that on a Windows PC? Note that I use Word 2011 on an Apple Mac! It does not use Windows but the Apple OS X operating system, release 10.7.5. So the problem may be a Mac vs Windows problem.
On my Mac your code produces the same error as my code, but before that your code does insert an endnote, with Roman numbering (i ii iii iv). However, that does not help me. I already have a shortcut for endnotes numbered i, ii, ii. What I need is endnotes numbered 1 2 3, i.e. Arabic numbering.
Reply With Quote
  #6  
Old 12-14-2012, 12:56 PM
macropod's Avatar
macropod macropod is offline Error on macro to insert endnotes on Mac Windows 7 64bit Error on macro to insert endnotes on Mac Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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,

Yes, I'm using Word on a PC, which is why I mentioned the versions.

The fact you're now getting the endnote shows that the problem isn't in its insertion, but with the code that sets its numbering format.

Within the 'With .EndnoteOptions' ... 'End With' block are four code lines. What we need to do is to find which one causes the error. Try commenting-out each line in turn to see whether the code will run withjust one line commented-out. If so, that's the problem line and we might be able to do something with that.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 12-15-2012, 08:36 AM
mbk mbk is offline Error on macro to insert endnotes on Mac Mac OS X Error on macro to insert endnotes on Mac Office for Mac 2011
Novice
Error on macro to insert endnotes on Mac
 
Join Date: Dec 2012
Posts: 6
mbk is on a distinguished road
Default All 4 lines produce error message

Dear Paul:
I have put a Comment sign <' > before all 4 lines in that block of code. That produced an endnote with roman number, and NO error message.
I then reactivated each line separately. When any of the 4 lines was activated I got an endnote with roman number AND an error message.
So did various other macros that I created to insert foot- or endnotes.
I repeated the whole rigmarole in Word 2003 under XP and everything runs without a hatch.
This looks like a problem of Word 2011 for Apple Mac!

PS: I also did it according to your literal instructions: comment out one line and leave the other 3 active. Same result for all 4 lines
Reply With Quote
  #8  
Old 12-15-2012, 09:58 PM
macropod's Avatar
macropod macropod is offline Error on macro to insert endnotes on Mac Windows 7 64bit Error on macro to insert endnotes on Mac Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Do you have the same problem if you run the macro in a new document? If it works in a new document, that suggests some corruption in the existing document.

If it doesn't work in a new document, do you have a colleague who has a Mac with Word 2011 so that you could try the macro on that as well? If it works there on a new document, that suggests a fault with your Word installation. If not, it points to a bug in Mac Word.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 12-19-2012, 01:24 PM
mbk mbk is offline Error on macro to insert endnotes on Mac Mac OS X Error on macro to insert endnotes on Mac Office for Mac 2011
Novice
Error on macro to insert endnotes on Mac
 
Join Date: Dec 2012
Posts: 6
mbk is on a distinguished road
Default

Dear Paul:

My colleague tells me he gets the same runtime error 4605 when he runs this macro. He is a professor of genetics, and highly experienced with computers. So it looks like this is a bug in Mac Word.
Could you bring this bug to the attention of your colleagues responsible for Mac Word?
And yes, I had the same problem when I ran the macro in a new document.
Reply With Quote
  #10  
Old 12-19-2012, 06:09 PM
macropod's Avatar
macropod macropod is offline Error on macro to insert endnotes on Mac Windows 7 64bit Error on macro to insert endnotes on Mac Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

OK, looks like it's a bug in Mac Word vba. I don't have any "colleagues responsible for Mac Word" - I don't even work for MS (never have). However, I can file bug reports.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 12-20-2012, 12:52 AM
mbk mbk is offline Error on macro to insert endnotes on Mac Mac OS X Error on macro to insert endnotes on Mac Office for Mac 2011
Novice
Error on macro to insert endnotes on Mac
 
Join Date: Dec 2012
Posts: 6
mbk is on a distinguished road
Default Thanks for your help!

Dear Paul:

I thought 'MS MVP' was an official function related to Microsoft. I owe you all the more thanks for the time and attention you spent on this. Could you do one last thing and tell Microsoft about this? They might take your report more seriously than mine.
Thanks again for your help!
mbk
Reply With Quote
  #12  
Old 12-20-2012, 01:03 AM
macropod's Avatar
macropod macropod is offline Error on macro to insert endnotes on Mac Windows 7 64bit Error on macro to insert endnotes on Mac Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Re the MS MVP designation, see: http://mvp.support.microsoft.com/default.aspx and http://www.mvps.org/about/
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
footnote, macro vba word, record



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error on macro to insert endnotes on Mac How to convert endnotes in a text doc to Word endnotes? Dickison Word VBA 4 10-06-2012 09:11 PM
Macro to insert new page... samanthaj Word 17 01-31-2012 01:53 PM
Powerpoint Macro To Insert Objects Sample lahuva PowerPoint 0 07-06-2011 10:51 AM
Insert Page Error nmbrown Word 1 10-28-2010 10:33 AM
Error on macro to insert endnotes on Mac Macro for Picture Insert rfhall50 Word VBA 2 10-25-2010 12:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft