Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Jan 2003
    Location
    San Francisco, California, USA
    Posts
    93
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Table Corruption? (VBA/Word/2003)

    Hello All,

    I am attempting to copy a table as a range, paste it (as unformatted text) into another document, and then delete the original table:
    ---------------------------------------
    oOldTable.Range.Copy
    g_rngNewDoc.PasteSpecial DataType:=wdPasteText
    oOldTable.Delete

    My code errors out at "oOldTable.Delete" and I receive this error message: "Error # 4605 - The delete method or property is not available because some or all of the object does not refer to a table." By all accounts it appears that the table is corrupted. When I attempt to select the original table Word selects text above the table and it appears to be confused.

    Has anyone else received this message and if so what conclusions did you come to?

    Kyle

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,807
    Thanks
    4
    Thanked 235 Times in 217 Posts

    Re: Table Corruption? (VBA/Word/2003)

    I would suggest you try either:
    1. Use cut instead of copy and then drop the third line altogether
    oOldTable.Range.Cut

    2. Add Range into the delete command
    oOldTable.Range.Delete
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Star Lounger
    Join Date
    Jan 2003
    Location
    San Francisco, California, USA
    Posts
    93
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Table Corruption? (VBA/Word/2003)

    Thanks Andrew. Actually this is how I originally wrote my code and it still produced the error. I ran the macro again and when the error came up I forced a pagination on the document and that clears the error. I'm just not sure this is a proper fix. I should explain that this macro is very lengthy and is applying a large amount of formatting to paragraphs and tables.

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,807
    Thanks
    4
    Thanked 235 Times in 217 Posts

    Re: Table Corruption? (VBA/Word/2003)

    You are dealing with multiple docs so perhaps you need to qualify the document in which the table range appears.

    Which line actually causes the error? Is it the Cut, Copy, Delete or PasteSpecial?

    How is oOldTable defined? From the error message it may not contain what you think it contains.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •