+ Reply to Thread
Results 1 to 9 of 9

Loop through if visible?

  1. #1
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Loop through if visible?

    I use this code to test all the pages in a Multipage control and if one of them is true then I want a true value. Is there a way I can loop through all the pages instead of the way I do it now - just in case I add a page, I would not need to go back and change the code everytime. Here is the code:

    Please Login or Register  to view this content.
    I use a with before it so that is why it starts with a .

  2. #2
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Loop through if visible?

    anyone have any ideas to loop through the pages?

  3. #3
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327

    Re: Loop through if visible?

    Hi djblois1

    Try something like:
    Please Login or Register  to view this content.
    Hope this helps

    Seamus

  4. #4
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Loop through if visible?

    I tried that just a few minutes before you suggested it but Page from (Dim pgError as Page) is recognized as an excel sheet (I think) because if you hit the . after it it give page setup options. and when I try to run it, it says Object does not support this property.

  5. #5
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327

    Re: Loop through if visible?

    Hi,

    Can you post just a wee bit more code so I can see what it's trying to do please

    Thanks

    Seamus

  6. #6
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Loop through if visible?

    Here is the Original Code:

    Please Login or Register  to view this content.
    Here is what I am trying:

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327

    Re: Loop through if visible?

    Hi
    In the attached book called Error File.xls I created a form called objForm with the following:

    A multipage called mpError
    with pages called pgError1 and pgError2
    Two command buttons called cmdCreateReport and cmdOK

    I then added this code to the Form in VBA and it seems to work

    Please Login or Register  to view this content.

    Is that working for you
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Loop through if visible?

    I tested your workbook and when I hit Ok, it gives me the same Error, "Type Mismatch"

  9. #9
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327

    Re: Loop through if visible?

    Hi there,

    Sorry but I can't really think of anything else to suggest

    Perhaps someone else may be able to shed some more light than me

    Seamus

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1