View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
RyanH RyanH is offline
external usenet poster
 
Posts: 586
Default For Each...Loop using Pages in a Multipage Control

Absolutely Dave! Thanks for the tip!
--
Cheers,
Ryan


"Dave Peterson" wrote:

I think you have a problem somewhere that you're masking. Your other code is ok
as far as I can see.

And if you add pages to that multipage control, you may not want to go back to
change the "from 0 to 2" lines. Easily fixed, yes. But it's easily missed,
too.

I'd use something like this to disable all the pages--no matter the count.

Dim i As Long
'disables all pages
With Me.mpgIllumination
For i = 0 To .Count - 1
.Pages(i).Enabled = False
Next i
End With

Much closer to what your "for each" code tried to do.

RyanH wrote:

For some reason this code was working yesterday. You even helped me with a
portion of it. But today it changed its mind and decided not to work so I
switched to this:

'disables all three pages
For i = 0 To 2
mpgIllumination.Pages(i).Enabled = False
Next i

Thanks for the help
--
Cheers,
Ryan

"Dave Peterson" wrote:

Your code worked ok for me.

What line caused the error?

(I don't have a guess, but maybe someone else will.)

RyanH wrote:

I am scattered today. Yesterday this code was working fine and today it is
not. I am getting a Type MisMatch Error indicated below, why?

Private Sub cboIllumination_Change()

Dim pg As Page

'disables all three pages
For Each pg In mpgIllumination.Pages
pg.Enabled = False
Next pg

End Sub

--
Cheers,
Ryan

--

Dave Peterson


--

Dave Peterson