 
    
    
 
	
	
		
		
	
	
	
	
		
	
	
		
			
- 
	
	
		
		
			
				
				
				
					Solved: concatenating a objectname with a variable
				
					
						
							Hi!
 
 Until 2 weeks ago i was a complete newbie to VBA, but i've been trying to build a little something in excel to do several magical things to a worksheet filled with adresses. I've learned a lot so far, but i've still got a lot of questions... (who hasn't?)
 
 But here is the one i'm currently fighting with:
 
 My VBA dynamically adds new objects (labels) on the userform frmDemo, but in a different sub i want to do something with those new objects.
 Their names are built up as a prefix "newLabel_" and a number.
 
 in the other sub all the numbers are stored in newComboNumber, and from there i want to reference to those new comboboxes, but how?
 
 could i do something like
 [vba]frmDemo!newLabel_ & newLabelNumber.caption="something"[/vba]
 
 If i do this, i get the error that the object cannot be found,
 while if i write the objectname without concatenating it with the number stored in the variable, it works like a charm!
 [vba]frmDemo!newLabel_1.caption="something"[/vba]
 
 Can anyone point me in the right direction?
 thanx!
 
 Regards,
 Casper
 The Netherlands
 
 
 
 
				
				
				
					
						Last edited by Koesper; 01-24-2006 at 01:57 AM.
					
					
						Reason: I already found a typo, i'm certain you'll find more
					
				 
 
 
 
 
 
	
	
	
	
	
	
	
	
	
	
	
	
		
		
			
				 Posting Permissions
				Posting Permissions
			
			
				
	
		- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-  
Forum Rules