Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default accesing controls in for each loop

hi all!

when you are using something like:

for each o in multipage1.pages(0).controls

next

o is the current control being 'looked' at out of the X number of controls
on multipage1.pages(0)

my question is - how do you access the previous control? ie so you could
compare the contents of the previous text box with the present text box.

tia!

J
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default accesing controls in for each loop

I suggest you don't use a For Each loop but a For i = x to y type instead:

Dim i As Integer
With MultiPage1.Pages(0)
'Index value of 1st control is 0 and last control is .Controls.Count - 1
For i = 1 To .Controls.Count - 1
MsgBox .Controls(i).Text & vbCr & .Controls(i - 1).Text
Next
'Alternate:
'For i = 2 To .Controls.Count
'MsgBox .Controls("TextBox" & i).Text & vbCr & .Controls("TextBox" & i -
1).Text
'Next
End With

Regards,
Greg Wilson

"Gixxer_J_97" wrote:

hi all!

when you are using something like:

for each o in multipage1.pages(0).controls

next

o is the current control being 'looked' at out of the X number of controls
on multipage1.pages(0)

my question is - how do you access the previous control? ie so you could
compare the contents of the previous text box with the present text box.

tia!

J

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
How to loop through controls on a MultiPage 42N83W Excel Programming 11 February 14th 05 11:32 PM
Loop through objects/controls on worksheet Tom V Excel Programming 2 September 16th 04 06:09 PM
loop through controls libby Excel Programming 0 August 14th 04 12:41 PM
Accesing vba project from wb that has vba project password protected cassidyr1 Excel Programming 2 July 3rd 04 01:49 PM
Accesing a combobox control via it index propertie in VBA, Is itPossible? Muxer Excel Programming 3 July 30th 03 08:20 PM


All times are GMT +1. The time now is 06:32 PM.

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"