Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Is there a way to test if a control exists on a userform?

maybe something like this

For s = 0 To .Frame1.Controls.Count - 1
If .Frame1.Controls(s).Name Like "OptionButton*"
Then

--


Gary Keramidas
Excel 2003


"Ryan H" wrote in message
...
I have a sub (ClearUserform) that is called by several userforms.
Sometimes
the control may not be on the userform passed to ClearUserform, thus I get
an
error. So I added the On Error Resume Next statement to quickly work
around
the error. Is there a way to test if the control exists on the userform
passed to the sub.

Sub MySub()
Call ClearUserform(Userform1)
End Sub

Sub ClearUserform(MyForm As UserForm)

On Error Resume Next
MyForm.TextBox1 = ""

' i have other controls list here

On Error GoTo 0

End Sub
--
Cheers,
Ryan


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 to see if Sheet exists BillyRogers Excel Programming 1 August 17th 07 03:48 PM
Names.add - Test to see if name already exists? Craigm[_51_] Excel Programming 5 May 1st 06 03:06 PM
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 06:51 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"