Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 26 of 26

Thread: Table has been deleted?

  1. #21
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    As a follow up... I downloaded your attachment, and ran the Showbug routine and got zero errors, no matter whether I had both lines in SetTableStyle commented, uncommented, or either one commented/uncommented.

    So I have performed 4 tests while running Showbug repeatedly on your .docm attachment.
    1. .AllowPageBreaks = False commented out, .Range.ParagraphFormat.KeepWithNext = True commented out
    2. .AllowPageBreaks = False uncommented, .Range.ParagraphFormat.KeepWithNext = True commented out
    3. .AllowPageBreaks = False commented out, .Range.ParagraphFormat.KeepWithNext = True uncommented
    4. .AllowPageBreaks = False uncommented, .Range.ParagraphFormat.KeepWithNext = True uncommented

    If the Showbug routine does actually cause an error on your system in at least one of the tests above, then try those same tests when you open the document in a "clean" Winword process (achieved by Start > Run > winword /a)

    If it causes a problem on your system in the clean winword process, then you need to a) tell us what version of Word you're working in and b) make sure you have all the latest service packs/hotfixes.

    I have concerns about the efficiency of your code and why you're using nested tables, but they really don't matter in terms of solving this problem. You have to identify whether you are encountering an actual bug, or if you're just dealing with document corruption. The solution will be quite a bit different, depending on that determination.

    Those are the next steps. Hope this helps.

  2. #22
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Well I have asked for fuller code twice, but I am being ignored.

    Ooooo, nested tables now is it? That can be an issue.

    I remain unconvinced it is a real bug.

    I will let Greg and Jason (Frosty) handle this - together they are the best of the best here - as it may be a 2010 issue (but I doubt that).
    Last edited by fumei; 09-06-2012 at 12:45 PM.

  3. #23
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Fumei,

    The OP actually did try to provide the full code in the attachment. But running that code requires being able to open the document, because he has tables constructed in it as well, which the routines use. I could, of course, work up a sample for you-- but all it would demonstrate is that there is no bug, at least as presented.

    Like you, I have my issues with nested tables-- but these nested tables are actually not causing a problem (at least, not yet). I question the *need* for nested tables at all, I would never want to take a buggy object (like tables) and then start nesting buggy objects within it. Grin.

    But I think it's likely to be a document corruption issue...

  4. #24
    VBAX Regular
    Joined
    Aug 2012
    Location
    France
    Posts
    13
    Location
    Thanks for all the feedback

    Actually I have importing my codes into a new document and it does the same thing. All my document does is updating tables so If I open a new document and instert tables with certain bookmarks it will update whatever is there.

    Anyway, I will try to attached another document which does the error consistently.

    thanks

  5. #25
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Sorry, AAhrenst... but I don't understand. You aren't having the error in the document you attached previously?

    Before you attach another document, make sure it causes the problem in a "winword /a" created process too, please.

    And what version of Word are you using?

  6. #26
    VBAX Newbie
    Joined
    Sep 2012
    Posts
    3
    Location

    thank you

    Quote Originally Posted by Frosty
    And by the way, using the Selection object in code, and then manipulating the document (i.e., the Selection object) while debugging your code can lead to lots of unexpected behavior.

    Off the top of my head--
    1. Your selection could look like it's after a table, but it's actually just before the end of the table marker... trying to manipulate that range is going to cause problems.

    2. Your selection could be right next to another table, which could cause an issue when you then create a new table at that spot (i.e., while your temptable variable may seem like it's handling one table, you might have caused word to merge the table with something).

    3. Your selection could be somewhere "bad"

    4. You could be encountering a real bug. This last scenario is the least likely since, as you say, you are a neophyte programmer. The most likely scenario is that you are causing your own problem.
    this is cool!!

Posting Permissions

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