Wrox Programmer Forums
BOOK: Excel VBA 24-Hour Trainer
This is the forum to discuss the Wrox book Excel VBA 24-Hour Trainer by Tom Urtis; ISBN: 978-0-470-89069-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Excel VBA 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 25th, 2013, 10:54 AM
Registered User
Join Date: Apr 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multipage in Userform

I've found the book very useful but I'm now trying (and failing) to do something not detailed in the book. If anyone can help I'd be grateful. This is the code I've written which runs when the user clicks a new page tab in a multipage in an Excel Userform:
Private Sub MultiPage1_Change()
'If a page has been changed, ensure previous page is complete
ok = True
Static ppindx
If MultiPage1.Value < 0 Then 'No pages active - do nothing
Exit Sub
ElseIf IsEmpty(ppindx) Then 'first time call to this procedure
ppindx = MultiPage1.Value
ElseIf ppindx <> MultiPage1.Value Then 'new page selected
For Each tb In MultiPage1.Pages(ppindx).Controls
If tb.Name Like "TextBox*" Then
If tb.Text = "" Then
MsgBox ("Must complete all information on current page.")
MultiPage1.Value = ppindx
tb.SelStart = 0
tb.SelLength = Len(tb.Text)
ok = False
Exit For
End If
End If
Next tb
End If
If ok = True Then
ppindx = MultiPage1.Value
End If
End Sub
What I'm trying to do is check whether the original page had been fully completed - textboxes filled in etc - before allowing the user to open the next page. If the original page was NOT completed I want to redisplay it and set the focus to the empty textbox. The above code fails when try to do that and if I step through the code one line at a time it seems to select the original page tab OK but not bring that page to the front. Subsequently, when I try to set the focus to the unfilled textbox it isn't visible and an error occurs.
I'm only a hobbyist as far as programming goes so my knowledge is pretty limited and I'd appreciate being pointed in the right direction here as I've played around with it for a long time now and haven't found a solution.

Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Multipage Suhaskurse Access VBA 2 June 1st, 2011 01:57 PM
multipage activate Fat_and_immoral Excel VBA 5 March 7th, 2007 02:03 PM
PHP Multipage to look like one Lofa PHP How-To 2 September 5th, 2006 12:52 PM
use of multipage MANOJMETAL VS.NET 2002/2003 0 April 17th, 2004 01:29 AM
Multipage Menu LHaines Classic ASP Basics 1 June 3rd, 2003 07:05 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.