• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Geeting Error "Microsoft Word got an error. Connection is invalid"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Geeting Error "Microsoft Word got an error. Connection is invalid"


  • Subject: Re: Geeting Error "Microsoft Word got an error. Connection is invalid"
  • From: Geoff Graham <email@hidden>
  • Date: Thu, 13 May 2010 10:39:45 -0400

I guess you didn't see me earlier response, but Scott is in error; one can get this message when word/excel has not crashed, but is simply busy executing a command. Steps that normally work, but sometimes get this, can usually be saved just by pausing your script long enough to let the previous operation finish. Having said that, I will say that the save and close commands for office on the mac are quirky at best, and downright broken in my experience. (I haven't used newer versions so perhaps it has been fixed.) I have used the following for many years in production with little problem:

tell application "System Events"
 tell (get first process whose frontmost is true)
   keystroke "s" using command down
   delay 8
   keystroke "q" using command down
   delay 2
 end tell
end tell

On your second error, I bet if you pause to give Word plenty of time to open, then it will execute the following find command.

Geoff

On May 13, 2010, at 1:40 AM, SHIVANK AGGARWAL, Noida wrote:

> Hi Scott,
>
> I am using Mac OS 10.5.8 and theWord I am using is 11.5.6 (word 2004).
>
> 1. This error generally comes when I try to save and close a document.
>
> The code I am using is:-
>
> Tell application "Microsoft Word"
>
> Close active document saving yes
>
> End tell
>
> 2. Secondly it comes when the document is just open and a search command is being fired.
>
> Open (document path)
>
> Execute find myFind with match forward
>
> Please throw some light on these issues.
>
> -----Original Message-----
> From: applescript-users-bounces+shivank.aggarwal=email@hidden [mailto:applescript-users-bounces+shivank.aggarwal=email@hidden] On Behalf Of Scott Babcock
> Sent: Tuesday, May 11, 2010 1:26 AM
> To: email@hidden
> Subject: RE: Geeting Error "Microsoft Word got an error. Connection is invalid"
>
> "Connection is invalid" indicates that the intended recipient of the message crashed. Do you have more details on your scenario? What OS are you running on, and what version of Word are you using (check the "About Word" dialog for this)? Code snippets that reproduce the issue are usually helpful.
>
> Checking state constantly will generally result in poor system performance. Scripting through System Events can also lead to instability, although it's generally System Events that crashes instead of the targeted application.
>
> -----Original Message-----
> Date: Mon, 10 May 2010 22:23:57 +0530
> From: "SHIVANK AGGARWAL, Noida" <email@hidden>
> Subject: Geeting Error "Microsoft Word got an error. Connection is invalid"
> To: "SHIVANK AGGARWAL, Noida" <email@hidden>,
> 	"email@hidden"
> 	<email@hidden>
> Message-ID:
> 	<email@hidden>
>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi All,
>
> I am getting following error "Microsoft Word got an error. Connection is invalid many times.
> Please throw some light on this issue as what could be possible reasons of the same.
>
> I am using System events to check Microsoft Word constantly whether it's a front most application or not.
>
>
> Also I am using word 2004 and my word crashes unexpectedly sometimes when I try to save and close a document using Applescript.
>
> Thanks In Advance,
> Shivank
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
> DISCLAIMER:
> -----------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
> this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
> this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
> received this email in error please delete it and notify the sender immediately. Before opening any mail and
> attachments please check them for viruses and defect.
>
> -----------------------------------------------------------------------------------------------------------------------
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >RE: Geeting Error "Microsoft Word got an error. Connection is invalid" (From: Scott Babcock <email@hidden>)
 >RE: Geeting Error "Microsoft Word got an error. Connection is invalid" (From: "SHIVANK AGGARWAL, Noida" <email@hidden>)

  • Prev by Date: Re: Scripting Help Viewer?
  • Next by Date: Avoiding A System Events Password
  • Previous by thread: RE: Geeting Error "Microsoft Word got an error. Connection is invalid"
  • Next by thread: How to sve a image from Word document to hard disk
  • Index(es):
    • Date
    • Thread