Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Message -2147220995 Automation Error

Status
Not open for further replies.

vellakaran

Programmer
May 22, 2003
9
CA
Here is the code that is causing the error:

Function OpenMicrosoftWord(objfrm_MSWord As BoundObjectFrame, obj_MSWord As Object, Optional DoOpen As Boolean = False) As Boolean

'This function opens Microsoft Word. This function requires a bound obect frame that
' contains microsoft word documents or templates.

On Error GoTo Errorhandler
Dim obj_MSWordApplication As Object

Dim bol_status As Boolean

bol_status = True

objfrm_MSWord.Verb = acOLEVerbOpen 'Tells MS Access to open the application
objfrm_MSWord.Action = acOLEActivate ' Activates the application

Set obj_MSWordApplication = objfrm_MSWord.Object.Application
If DoOpen Then
obj_MSWordApplication.Run Macroname:="MyOpen"
End If

Set obj_MSWord = obj_MSWordApplication.ActiveDocument

OpenMicrosoftWord = bol_status
Exit Function

Errorhandler:
If (Err <> 4633) And (Err <> -2147352573) Then
OpenMicrosoftWord = False
Select Case Err
Dim varRetVal As Variant
Case -2147220995
OpenMicrosoftWord = True
Resume Next
Case Else: varRetVal = ErrorMsg(&quot;OpenMicrosoftWord&quot;, Err, Error)
End Select
Else
Set obj_MSWord = obj_MSWordApplication.ActiveDocument
OpenMicrosoftWord = bol_status
End If
End Function

I added the code to trap the error -2147220995. Now it appears other things are going wrong. The app will shut down (and pop-up the Do you want to send this error message to Microsoft messagebox..) when a user opens a new document which causes the above code to be run.

The -2147220995 error was not occurring all the time nor to everyone (300+ users). When it did happen, none of the data would be lost from the Word document they were working on. So I thought I would just trap it and suppress the message, but now there seems to be other issues.

Also a user just notified me that she got a, &quot;Expression too complex Error 16&quot; error in the above Function.

Anybody have any ideas what is going on, or why I would get the -214722095 error in the first place. The above code was written in Access 97 and we recently went to Access 2002. We are using XP the Professional Edition.

I also dont know exactly where it is happening in the code, because I have been unable to repplicate on my machine, that is why I decided just to trap it.

Thanks for any help and sorry for the long post!
EC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top