Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Run-time Error 4605 in Word 2003 (Word 2003/XP)

    Hi all.

    Very briefly, I have encountered a strange problem when migrating a template from Word XP to Word 2003. In my code, I format each table in a document by looping through the collection. It works without a hitch in XP, but I get Run-time error 4605 in Word 2003 that says, "The Alignment method or property is not available because some or all of the object does not refer to a table." The nature of this error doesn't make any sense, though, as it occurs in a function that takes a table as its argument and which is called from the following loop:

    For Each tTable In NewDoc.Tables
    Format_PS_Table tTable
    Next

    The function itself is just some very straightforward table formatting commands.
    Sub Format_PS_Table(tTable As Table)
    Dim rRow As Row

    tTable.Rows.Alignment = wdAlignRowLeft
    With tTable
    .LeftPadding = InchesToPoints(0.05)
    .RightPadding = InchesToPoints(0.05)
    .Spacing = 0
    .AllowPageBreaks = True
    .AllowAutoFit = False
    ...blah, blah, blah

    I have tested the template on both platforms with the exact same document, and the error consistently occurs in 2003 unless I either 1) precede the function call with "tTable.Select" or 2) if I step through the code. (It would seem like it's taking a few seconds for Word to get its act together before the function is called!) Has anybody had any similar experiences?
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Run-time Error 4605 in Word 2003 (Word 2003/XP)

    I tried out your code on a 26 page document with 14 tables in Word 2003 SP-2 (without adding tTable.Select). It ran without error. I then tried it on a 12350 page document with 6650 tables. It took more than 2 minutes to complete, but again, it ran without error.
    Do you have SP2?

  3. #3
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run-time Error 4605 in Word 2003 (Word 2003/XP)

    D'oh! I think I figured it out. (BTW, I am using SP2.)

    Prior to formatting the tables, the code copies sections from another document, hence the necessity to "clean up" each table. In my ongoing effort to rule out ANYTHING I could think of, I just now used the "open and repair" facility to open the document from which the data was copied, and lo and behold! there were tons of "Numbered Styles" errors (cue "Look of Surprise!") Sure enough, once I saved the "repaired" file and re-ran the utility (i.e. after "repaired data" was copied in top the new file), everything worked fine.

    I just wish that the error handling between the two versions were the same, or at least a little more accurate.
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run-time Error 4605 in Word 2003 (Word 2003/XP

    > 4605 in Word 2003 that says, "The Alignment method
    Yabbut in Word2000 it says " ... the current seleciton is not within a frame".
    Which it is, because Selection.Frames.Count is equal to 1.

    I believe my problem arises because Word/VBA cannot/will not delete a frame that lies within a table.

    I suspect Bill Gates's merry men have been recycling run-time-error numbers again.

    This <post#=167,988>post 167,988</post#> yields yet another use of 4605.
    Attached Images Attached Images
    • File Type: jpg 3.JPG (11.0 KB, 0 views)

Posting Permissions

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