Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If syntax to test if command button exists


I'm having trouble coming up with the exact syntax for an if statement
to determine if the following command button exists (so code will be
automatically excuted if it does exist):

Application.CommandBars(1).Controls("TestCode")

Any & all help would be greatly appreciated. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=471962

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default If syntax to test if command button exists

Dim cb as Object
On error resume next
cb = Application.CommandBars(1).Controls("TextCode")
On Error goto 0
if cb is nothing then
' doesn't exist
End if
--
Regards,
Tom Ogilvy

"mikeburg" wrote in
message ...

I'm having trouble coming up with the exact syntax for an if statement
to determine if the following command button exists (so code will be
automatically excuted if it does exist):

Application.CommandBars(1).Controls("TestCode")

Any & all help would be greatly appreciated. mikeburg


--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile:

http://www.excelforum.com/member.php...o&userid=24581
View this thread: http://www.excelforum.com/showthread...hreadid=471962



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
Test if file exists Daniel Bonallack Excel Discussion (Misc queries) 2 May 4th 09 04:19 PM
How to test Worksheet exists before trying to create it? CRayF Excel Programming 7 September 23rd 05 08:33 AM
How to test if a DLL (library) exists ExcelMonkey Excel Programming 2 August 7th 05 08:14 PM
Test for Worksheet Exists bcmiller[_8_] Excel Programming 4 July 2nd 04 11:46 AM
Test if a folder exists Jeff Marshall Excel Programming 6 September 30th 03 05:21 PM


All times are GMT +1. The time now is 05:22 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"