Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Run-time Error 4605 with Error ConvertToText (2003)

    When running the following VBA code -
    ActiveDocument.Tables(1).Cell(1, 2).Range.Text = Documents("PROJECTDashboard-CHCF_Master.doc").txtProjectName
    ActiveDocument.Tables(2).Cell(1, 2).Range.Text = Documents("PROJECTDashboard-CHCF_Master.doc").txtPMName
    ActiveDocument.Tables(2).Cell(2, 2).Range.Text = Date
    ActiveDocument.Tables(2).Cell(3, 2).Range.Text = Documents("PROJECTDashboard-CHCF_Master.doc").txtDate
    ActiveDocument.Tables(4).Cell(1, 1).Range.FormattedText = Documents("PROJECTDashboard-CHCF_Master.doc").Tables(1).Cell(3, 1).Range.FormattedText
    ActiveDocument.Tables(4).ConvertToText

    I receive the 4605 error - This method or property is not available because some or all of the object does not refer to a table on the last line of code.

    Any suggestions would be appreciated,
    Al

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

    Re: Run-time Error 4605 with Error ConvertToText (2003)

    Without seeing the document, I don't think it's possible to tell what is wrong. Could you attach a version of the document as it is after executing the code up to but not includng the last line of code?

  3. #3
    Lounger
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run-time Error 4605 with Error ConvertToText (2003)

    Hans -

    I

  4. #4
    Lounger
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run-time Error 4605 with Error ConvertToText (2003)

    Hans -

    Here is the 2nd document which is called from the first.

    Data is moved correctly up to the ConvertToText line of code.

    Thanks,
    Al

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

    Re: Run-time Error 4605 with Error ConvertToText (2003)

    Setting the FormattedText of the cell apparently creates a table-within-a-table or something like that. After that instruction, Word gets confused about what Tables(4) actually is - asking for the number of tables in the document even makes Word use 100% CPU until you force it to close. Try copy and paste:

    Documents("PROJECTDashboard-CHCF_Master-StrippedDown.doc").Tables(1).Cell(3, 1).Range.Copy
    ActiveDocument.Tables(4).Cell(1, 1).Range.Paste
    ActiveDocument.Tables(4).ConvertToText
    '
    'After converting the table to text, since the table no longer exists, the next table becomes table 4
    '
    Documents("PROJECTDashboard-CHCF_MasterStrippedDown.doc").Tables(1).Cell(5, 1).Range.Copy
    ActiveDocument.Tables(4).Cell(1, 1).Range.Paste
    ActiveDocument.Tables(4).ConvertToText

  6. #6
    Lounger
    Join Date
    Jun 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Run-time Error 4605 with Error ConvertToText (2003)

    Hans -

    That did the trick ! Great work!

    Thanks,
    Al

Posting Permissions

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