locked
Does Word 2010 have a different syntax than Word 2013 to access the value of a cell in a table? RRS feed

  • Question

  • Hello,

    I have been scratching my head for while over this, but does Word 2010 have a different syntax to access the value of a cell in a table. The following syntax works in Word 2013

    ActiveDocument.Tables(3).Cell(Row:=1, Column:=1).Range.Text

    However macro execution chokes at this and Word returns runtime error '5941', 'the requested member of the collection does not exist'.

    Any ideas why this is happening?

    Thanks!

    Tuesday, January 28, 2014 3:46 PM

Answers

  • Okay, I was able to figure out what the problem was. The document I am looking for is in the old word format (.doc) and that property does not seem to work properly in Word 2010 for .doc type files. When I saved the document as .docx file. I had no issue. I hope someone will find this useful
    • Marked as answer by John Martel Tuesday, January 28, 2014 6:29 PM
    Tuesday, January 28, 2014 6:28 PM

All replies

  • Okay, I was able to figure out what the problem was. The document I am looking for is in the old word format (.doc) and that property does not seem to work properly in Word 2010 for .doc type files. When I saved the document as .docx file. I had no issue. I hope someone will find this useful
    • Marked as answer by John Martel Tuesday, January 28, 2014 6:29 PM
    Tuesday, January 28, 2014 6:28 PM
  • While that may have addressed the problem, it doesn't explain why it would not work in the document saved as DOC format. The code you posted should work with DOC and DOCX in both Word 2010 and 2013. Check your Trust Center settings.

    Graham Mayor - Word MVP
    www.gmayor.com

    Wednesday, January 29, 2014 11:56 AM