Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Is there a way in VBA to check if a particular Sub exits inThisWorkbook?

I would like to be able to have my program check to see if a custom
Subroutine with a particular name exists in ThisWorkbook of VBA
Project (Book1) and call it if it exists. Is there a way to do this?

Greg
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Is there a way in VBA to check if a particular Sub exits in ThisWo

Dear Greg

Please refer http://www.cpearson.com/Excel/vbe.aspx

If this post helps click Yes
---------------
Jacob Skaria


"Greg" wrote:

I would like to be able to have my program check to see if a custom
Subroutine with a particular name exists in ThisWorkbook of VBA
Project (Book1) and call it if it exists. Is there a way to do this?

Greg

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Is there a way in VBA to check if a particular Sub exits in ThisWorkbook?


I would like to be able to have my program check to see if a custom
Subroutine with a particular name exists in ThisWorkbook of VBA
Project (Book1) and call it if it exists. Is there a way to do this?



Well this method doesn't really 'test' if the Subroutine exists, but rather
try to call the Subroutine, and then just continue if it doesn't exists:


On Error Resume Next
Application.Run "Name of Subroutine"
On Error Goto 0


By using 'Application.Run' you'll also avoid any Compiler error if the
Subroutine doesn't exists upon execution of your code.

Hope this can solve your problem :-)




Reply
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find if value exits in array Glynn Excel Worksheet Functions 6 September 5th 08 08:46 PM
If Search that Exits Sub or Ends If Ryan Hess Excel Programming 1 July 27th 07 09:16 PM
Spacebar Exits Macro Zone[_2_] Excel Programming 6 December 31st 06 07:15 PM
Sub Exits Unexpectedly Walker Excel Programming 4 July 25th 05 10:43 PM
graceful exits Bryan[_12_] Excel Programming 3 November 23rd 04 07:56 PM


All times are GMT +1. The time now is 07:39 AM.

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

About Us

"It's about Microsoft Excel"