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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i disable the VBA debug panel in BO

Status
Not open for further replies.

erwan

Programmer
Aug 24, 2000
19
FR
Hi!
Is it possible to disable the debug panel or debug button when there is an error on the report with the VBA.

I just want to see the error code and message but i don't want the users see the VBA code.

thanks for your help!
Erwan
 
You might want to consider error trapping,
ie

Sub MyRoutine()
On Error Goto ErrHandler
your code..

ExitPoint:
exit sub

ErrHandler:
MsgBox err.number & vbCr & err.Description
goto exit sub

end sub
 
'goto exit sub'

should read

'goto ExitPoint'

Sorry about that!
 
You can also disable break on vba errors:

[tt] Application.BreakOnVBAError = false[/tt]

This will prevent BO from showing the VBA debugger when an error occurs. It even works with compiling/linking errors (asuming the procedure where you made the previous asignment has not compiling/linking errors). By linking, I refer to linking with external libraries.

For best safety, I use both solutions: [tt]On Error[/tt] and [tt]BreakOnVBAError[/tt]. The main macro is similar to:
[tt]
Sub MainMacro (...)
On Error Resume Next

Application.Interactive = false
Application.BreakOnVBAError = false

ActualMacro (...)

Application.Interactive = true
Application.BreakOnVBAError = true
end Sub
[/tt]
Where [tt]ActualMacro[/tt] is the procedure wich makes the real task. I use [tt]On Error[/tt] and error treatment inside [tt]ActualMacro[/tt] where needed, as erwan says.

This combined solution is useful when, for example, your macro ([tt]ActualMacro[/tt] in this case) uses a library that is not present on the computer the document is running on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top