How to close/supress error dialog box programatically

C

Chris L

Hi,

Can someone help me....
I'm trying to find a way to close/supress error dialog box programatically...

I'm not able to suppress the message with
DoCmd.SetWarnings False
.....
DoCmd.SetWarnings True
because the error comes from ActiveX control.

then I tried to use FindWindow and PostMessage API function, but as the
dialog box is modal dialog, the code doesn't work.
Private Sub SetRTFFont(ByRef objRichCtrl As CustomControl)
If Me.LCID = 1041 Then
objRichCtrl.Object.Enabled = True
objRichCtrl.Object.SelStart = 0
objRichCtrl.Object.SelLength = 65000
objRichCtrl.Object.SelFontName = "MS Mincho"
objRichCtrl.Object.SelFontSize = 11
End If
Dim lhandle As Long
lhandle = FindWindow(0&, "RTF2")
Do While lhandle <> 0
lhandle = PostMessage(lhandle, WM_CLOSE, 0&, 0&)
lhandle = FindWindow(0&, "RTF2")
Loop
End Sub

Error handling also doesn't work
On Error GoTo Err_Check
....
Exit_CheckExit:
Exit Sub

Exit_Check:
Err.Clear
Resume Next

Regards,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top