Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-03-2015, 12:21 AM
MOHAMMEDSALMAN MOHAMMEDSALMAN is offline Removing controls from userform Windows 7 64bit Removing controls from userform Office 2007
Novice
Removing controls from userform
 
Join Date: Sep 2015
Location: Mumbai
Posts: 9
MOHAMMEDSALMAN is on a distinguished road
Default Removing controls from userform


My program is about to complete but there is a minor problem.

I have a combo box and dynamically created checkboxes. When the combo box item changes the no. of checkboxes that will be displaced will change, what I want is when combo box item changes all the controls on the userform should be automatically removed. In short, I want to remove the controls of userform on combo box change.

I am using the below code but its giving me an "Invalid Argument" error.

Code:
Public Sub chkbox_remover(loop_ulimit As Integer, ctrl_name As String)
Dim looper As Integer

If eqp_count > 0 Then
    If loop_ulimit > 0 Then
        For looper = 1 To loop_ulimit
            frmEqpDetails.Controls.Remove ctrl_name & looper
        Next looper
    End If
End If

End Sub
In the above code "loop_ulimit" is the maximum number of controls in the userform. "eqp_count" is the count of checkboxes that will appear in userform on combo box selection and "looper" is the no. of controls on userform. I had already defined "eqp_count" as a global variable.
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
UserForm to Add XML Mapped Content Controls DocTeam10 Word VBA 0 10-08-2015 08:27 AM
VBA Code in a UserForm module to delete a Command Button which opens the userform Simoninparis Word VBA 2 09-21-2014 03:50 AM
Removing controls from userform Is it possible to take an input from a UserForm in one document to a UserForm in a do BoringDavid Word VBA 5 05-09-2014 09:08 AM
Removing controls from userform Content Controls Sammie0Sue Word 6 11-06-2013 10:56 PM
Can't Download Controls BillTheAdmin Project 2 12-05-2005 10:20 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft