Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2004
    Location
    Prague, Czech Republic
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Troubles with Excel - Word Automation (Office 2k)

    Hello,

    I have a rather complex code that generates a report from several excel files and copies the pictures and text into Word. Some of the Excel files are changed on the fly and they need to be recalculated. Then I copy it as a picture and insert into Word.
    Sometimes (it seems to be rather a random pattern) I get an error "Remote server not available", I have to close the half-finished Word document and restart the code. I tried to play with Application.OnTime to give Excel some time to recalculate but it does not seem to change anything.
    I run the code from Excel, Word is serving as client.
    Thanks in advance for any suggestions.
    Regards,
    Martin

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

    Re: Troubles with Excel - Word Automation (Office 2k)

    Check very carefully that all Word code you use refers explicitly to the Word.Application (or Word.Document) object you create. For example, if you have something like Dim objWord As New Word.Application, always use objWord.ActiveDocument.Paragraphs(1) and not ActiveDocument.Paragraphs(1).

  3. #3
    Lounger
    Join Date
    Jan 2004
    Location
    Prague, Czech Republic
    Posts
    41
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Troubles with Excel - Word Automation (Office 2k)

    Thank you very much Hans,
    it seems that these lines:
    <pre>With .ActiveDocument.Shapes(ActiveDocument.Shapes.Count )
    and
    .Left = InchesToPoints(0)
    </pre>


    were causing the troubles. I changed it to
    <pre>With .ActiveDocument.Shapes(.ActiveDocument.Shapes.Coun t)
    and
    .Left = Application.InchesToPoints(0)</pre>


    Thanks again
    Regards,
    Martin

Posting Permissions

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