LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

Hi Jack

See this code on Chip's site

You can use the VBA Extensibility tools to determine whether a module exists, or a procedure exists in a module.

Function ModuleExists(ModuleName As String) As Boolean
On Error Resume Next
ModuleExists = Len( _
ThisWorkbook.VBProject.VBComponents(ModuleName).Na me) < 0
End Function

Function ProcedureExists(ProcedureName As String, _
ModuleName As String) As Boolean
On Error Resume Next
If ModuleExists(ModuleName) = True Then
ProcedureExists = ThisWorkbook.VBProject.VBComponents(ModuleName) _
.CodeModule.ProcStartLine(ProcedureName, vbext_pk_Proc) < 0
End If
End Function

http://www.cpearson.com/excel/vbe.htm




--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jack Sons" wrote in message ...
Hi all,

In the code below ABCD can be executed if it is a subroutine - sub ABCD() - in a module elsewhere in the same project. If ABCD is
a not an existing sub the execution will halt, an error message wil appear on screen and a sound wil be produced. Fore some reason
I want to hear that sound but I don't want the the program to halt. If possible it would be nice if also the message box does not
appear, but I need to hear the error sound. To my regret I did not succeed with the code below.

Anybody who knows what code is needed to let the program continue when execution comes to the line with the undefined ABCD but do
let the error message sound hear?

Jack Sons
The Netherlands


Sub ingnoreABCD()
........... ' here the program already did some things
Application.DisplayAlerts = False
ABCD
Application.DisplayAlerts = True
.............. ' here I want to do what the program should do
End Sub



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"