Reply
 
Thread Tools Display Modes
  #1   Report Post  
raymond
 
Posts: n/a
Default Macro Run-time Error '5941'

Help,

A macro I had been using in Word 2002 is now giving me an error message :
"The requested member of the collection does not exist."

I hope I don't have to re-create this macro...

Any one...?

Thanks!


  #2   Report Post  
Jay Freedman
 
Posts: n/a
Default

raymond wrote:
Help,

A macro I had been using in Word 2002 is now giving me an error
message : "The requested member of the collection does not exist."

I hope I don't have to re-create this macro...

Any one...?

Thanks!


Hi Raymond,

What you've posted isn't quite enough information to be able to help. When
the error occurs, there should be two buttons in the message box, Debug and
Cancel. Click the Debug button, which opens the macro editor. The line where
the error occurred should be highlighted. Paste that line into a reply
message, so we can see which collection the message is talking about.

This sort of error often has more to do with what's in the current document
than with how the macro is constructed. For example, if the macro expects to
work with a table, it may contain a reference to ActiveDocument.Tables(1).
But if the document doesn't contain any tables, that reference will cause
the "does not exist" error message.

A properly written macro should test the document to make sure all the
expected bits are there, and either compensate or quit if they aren't. At
worst your macro needs to have such tests added to the existing code.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org


  #3   Report Post  
raymond
 
Posts: n/a
Default

Thanks for your response!

Here is the highlighted line in the debug dialogue:

With Selection.InlineShapes(1)

This macro was helping me to format, prompt for caption, and update a list
of figures for inserted digital image files. I have it saved in a template.

Thanks for your help...I hope i don't have to record the macro again...

Raymond

"Jay Freedman" wrote in message
...
raymond wrote:
Help,

A macro I had been using in Word 2002 is now giving me an error
message : "The requested member of the collection does not exist."

I hope I don't have to re-create this macro...

Any one...?

Thanks!


Hi Raymond,

What you've posted isn't quite enough information to be able to help. When
the error occurs, there should be two buttons in the message box, Debug
and
Cancel. Click the Debug button, which opens the macro editor. The line
where
the error occurred should be highlighted. Paste that line into a reply
message, so we can see which collection the message is talking about.

This sort of error often has more to do with what's in the current
document
than with how the macro is constructed. For example, if the macro expects
to
work with a table, it may contain a reference to ActiveDocument.Tables(1).
But if the document doesn't contain any tables, that reference will cause
the "does not exist" error message.

A properly written macro should test the document to make sure all the
expected bits are there, and either compensate or quit if they aren't. At
worst your macro needs to have such tests added to the existing code.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org




  #4   Report Post  
raymond
 
Posts: n/a
Default

Let's see, since first using the macro in the template i have reinstalled
Office 2002. How might that be causing a problem?

thanks again!


"raymond" wrote in message
...
Thanks for your response!

Here is the highlighted line in the debug dialogue:

With Selection.InlineShapes(1)

This macro was helping me to format, prompt for caption, and update a list
of figures for inserted digital image files. I have it saved in a
template.

Thanks for your help...I hope i don't have to record the macro again...

Raymond

"Jay Freedman" wrote in message
...
raymond wrote:
Help,

A macro I had been using in Word 2002 is now giving me an error
message : "The requested member of the collection does not exist."

I hope I don't have to re-create this macro...

Any one...?

Thanks!


Hi Raymond,

What you've posted isn't quite enough information to be able to help.
When
the error occurs, there should be two buttons in the message box, Debug
and
Cancel. Click the Debug button, which opens the macro editor. The line
where
the error occurred should be highlighted. Paste that line into a reply
message, so we can see which collection the message is talking about.

This sort of error often has more to do with what's in the current
document
than with how the macro is constructed. For example, if the macro expects
to
work with a table, it may contain a reference to
ActiveDocument.Tables(1).
But if the document doesn't contain any tables, that reference will cause
the "does not exist" error message.

A properly written macro should test the document to make sure all the
expected bits are there, and either compensate or quit if they aren't. At
worst your macro needs to have such tests added to the existing code.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org






  #5   Report Post  
Jay Freedman
 
Posts: n/a
Default

Hi Raymond,

Reinstalling doesn't have anything to do with it.

The line of code that was highlighted, which was where the error
occurred, is telling VBA to locate the first picture (inline shape,
that is, not a floating shape) within the highlighted text (the
Selection). If the Selection doesn't contain any inline shapes, then
that line causes an error:

The requested member [that is, shape 1] of the collection [the
InlineShapes collection belonging to the Selection] does not
exist.

What I can't tell yet is why the Selection is supposed to contain at
least one inline shape. Are you supposed to select the paragraph (or
other text) containing the shape before you start the macro? Or is the
macro supposed to do a search for shapes in the document? If you can't
tell from reading the macro, post the whole code here and I'll have a
look for you.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

On Fri, 24 Jun 2005 14:41:25 -0800, "raymond"
wrote:

Let's see, since first using the macro in the template i have reinstalled
Office 2002. How might that be causing a problem?

thanks again!


"raymond" wrote in message
...
Thanks for your response!

Here is the highlighted line in the debug dialogue:

With Selection.InlineShapes(1)

This macro was helping me to format, prompt for caption, and update a list
of figures for inserted digital image files. I have it saved in a
template.

Thanks for your help...I hope i don't have to record the macro again...

Raymond

"Jay Freedman" wrote in message
...
raymond wrote:
Help,

A macro I had been using in Word 2002 is now giving me an error
message : "The requested member of the collection does not exist."

I hope I don't have to re-create this macro...

Any one...?

Thanks!

Hi Raymond,

What you've posted isn't quite enough information to be able to help.
When
the error occurs, there should be two buttons in the message box, Debug
and
Cancel. Click the Debug button, which opens the macro editor. The line
where
the error occurred should be highlighted. Paste that line into a reply
message, so we can see which collection the message is talking about.

This sort of error often has more to do with what's in the current
document
than with how the macro is constructed. For example, if the macro expects
to
work with a table, it may contain a reference to
ActiveDocument.Tables(1).
But if the document doesn't contain any tables, that reference will cause
the "does not exist" error message.

A properly written macro should test the document to make sure all the
expected bits are there, and either compensate or quit if they aren't. At
worst your macro needs to have such tests added to the existing code.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org






Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Table in a Form HiDbLevel Tables 12 February 27th 06 12:59 PM
Macro Button Won't Stay on Toolbar caleb Microsoft Word Help 2 June 14th 05 11:59 PM
Possible bug when recording a Word Macro Raven95 Microsoft Word Help 4 April 30th 05 09:49 PM
Running document macro from server Intravler New Users 0 March 4th 05 04:33 AM
2000 to 2002 macro and "Could not open macro storage" Art Farrell Mailmerge 1 December 6th 04 12:40 PM


All times are GMT +1. The time now is 08:20 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"