Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Label Caption Just Wont Work on UserForm

Hello

I just can't figure this out.
I am using Label Caption to deliver messages on a Userform (see below)

When I step through the procedure the Caption works. When I run it does
not.

The ValidateDate Sub uses LabelMessage.Caption (different message) , and
this works fine when I run it.

When I move
LabelMessage.Caption = "Testing Date. Please Wait"
to within the VaildateDate Sub the same problem described above occurs

What am I missing
Thanks for any suggestions


Private Sub lblStartDate_Click()
Dim TCTestDate As String
TCTestDate = txtStartDate.Value
LabelMessage.Caption = "Testing Date. Please Wait"

Call ValidateDate( )
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Label Caption Just Wont Work on UserForm

There is nothing to stop the code from executing.

I think you want a Userform1.show somewhere in there (after you initialize
it)

Call ValidateDate( )
......test for valid date here----
If TestDate = False Then
LabelMessage.Caption = "Invalid " & WhichDate & _
" Enter new date & Click Date Label"

Load UserForm1

With Userform1
If WhichDate = "StopDate" Then

.txtStopDate.Value = ""
.txtStopDate.SetFocus
.txtStopDate.SelStart = 0
.txtStopDate.SelLength = Len(txtStopDate.Text)

ElseIf WhichDate = "StartDate" Then

.txtStartDate.Value = ""
.txtStartDate.SetFocus
.txtStartDate.SelStart = 0
.txtStartDate.SelLength = Len(txtStartDate.Text)

End If
.show
End With
End If
end sub

perhaps. Don't know where txtStartDate and txtStopDate are located. Assume
Userform1.



K wrote in message
...
Thank you very much. This worked fine with just DoEvents.

I don't understand why the program does not yield to the User, as a

similar
problem occured when I tried to test two dates as follows


Private Sub cmbTestDates_Click()

Call lblStartDate_Click
Call lblStopDate_Click

End Sub

The program goes on to the second Call procedure before the User

interactions
required in the first one is completed. If I just have any one Call

procedure
it works fine.
The portion of the coding that requires User interaction looks like this.

Call ValidateDate( )
.....test for valid date here----
If TestDate = False Then
LabelMessage.Caption = "Invalid " & WhichDate & " Enter new date &

Click
Date Label"
Load UserForm1
If WhichDate = "StopDate" Then

txtStopDate.Value = ""
txtStopDate.SetFocus
txtStopDate.SelStart = 0
txtStopDate.SelLength = Len(txtStopDate.Text)

ElseIf WhichDate = "StartDate" Then

txtStartDate.Value = ""
txtStartDate.SetFocus
txtStartDate.SelStart = 0
txtStartDate.SelLength = Len(txtStartDate.Text)

End If

End If
end sub

Tom Ogilvy wrote:

Private Sub lblStartDate_Click()
Dim TCTestDate As String
TCTestDate = txtStartDate.Value
LabelMessage.Caption = "Testing Date. Please Wait"
' me.Repaint ' uncomment if DoEvents doesn't solve it
DoEvents

Call ValidateDate( )
End Sub

--
Regards,
Tom Ogilvy

K wrote in message
...
Hello

I just can't figure this out.
I am using Label Caption to deliver messages on a Userform (see below)

When I step through the procedure the Caption works. When I run it

does
not.

The ValidateDate Sub uses LabelMessage.Caption (different message) ,

and
this works fine when I run it.

When I move
LabelMessage.Caption = "Testing Date. Please Wait"
to within the VaildateDate Sub the same problem described above occurs

What am I missing
Thanks for any suggestions


Private Sub lblStartDate_Click()
Dim TCTestDate As String
TCTestDate = txtStartDate.Value
LabelMessage.Caption = "Testing Date. Please Wait"

Call ValidateDate( )
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Label Caption Just Wont Work on UserForm

Thank you again for your suggestion.
I get a " Userform already open. Cannot show Userform modally " error message
I have tried placing Userform.Show / DeEvents at various places,
but I am stumped.

All I am trying to do is validate two dates in two different userform text boxes
, and get the User to resubmit them if they're invalid

Appreciate any other ideas from the Newsgroup.Thanks

Tom Ogilvy wrote:

There is nothing to stop the code from executing.

I think you want a Userform1.show somewhere in there (after you initialize
it)

Call ValidateDate( )
.....test for valid date here----
If TestDate = False Then
LabelMessage.Caption = "Invalid " & WhichDate & _
" Enter new date & Click Date Label"

Load UserForm1

With Userform1
If WhichDate = "StopDate" Then

.txtStopDate.Value = ""
.txtStopDate.SetFocus
.txtStopDate.SelStart = 0
.txtStopDate.SelLength = Len(txtStopDate.Text)

ElseIf WhichDate = "StartDate" Then

.txtStartDate.Value = ""
.txtStartDate.SetFocus
.txtStartDate.SelStart = 0
.txtStartDate.SelLength = Len(txtStartDate.Text)

End If
.show
End With
End If
end sub

perhaps. Don't know where txtStartDate and txtStopDate are located. Assume
Userform1.

K wrote in message
...
Thank you very much. This worked fine with just DoEvents.

I don't understand why the program does not yield to the User, as a

similar
problem occured when I tried to test two dates as follows


Private Sub cmbTestDates_Click()

Call lblStartDate_Click
Call lblStopDate_Click

End Sub

The program goes on to the second Call procedure before the User

interactions
required in the first one is completed. If I just have any one Call

procedure
it works fine.
The portion of the coding that requires User interaction looks like this.

Call ValidateDate( )
.....test for valid date here----
If TestDate = False Then
LabelMessage.Caption = "Invalid " & WhichDate & " Enter new date &

Click
Date Label"
Load UserForm1
If WhichDate = "StopDate" Then

txtStopDate.Value = ""
txtStopDate.SetFocus
txtStopDate.SelStart = 0
txtStopDate.SelLength = Len(txtStopDate.Text)

ElseIf WhichDate = "StartDate" Then

txtStartDate.Value = ""
txtStartDate.SetFocus
txtStartDate.SelStart = 0
txtStartDate.SelLength = Len(txtStartDate.Text)

End If

End If
end sub

Tom Ogilvy wrote:

Private Sub lblStartDate_Click()
Dim TCTestDate As String
TCTestDate = txtStartDate.Value
LabelMessage.Caption = "Testing Date. Please Wait"
' me.Repaint ' uncomment if DoEvents doesn't solve it
DoEvents

Call ValidateDate( )
End Sub

--
Regards,
Tom Ogilvy

K wrote in message
...
Hello

I just can't figure this out.
I am using Label Caption to deliver messages on a Userform (see below)

When I step through the procedure the Caption works. When I run it

does
not.

The ValidateDate Sub uses LabelMessage.Caption (different message) ,

and
this works fine when I run it.

When I move
LabelMessage.Caption = "Testing Date. Please Wait"
to within the VaildateDate Sub the same problem described above occurs

What am I missing
Thanks for any suggestions


Private Sub lblStartDate_Click()
Dim TCTestDate As String
TCTestDate = txtStartDate.Value
LabelMessage.Caption = "Testing Date. Please Wait"

Call ValidateDate( )
End Sub



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
label caption gramps Excel Discussion (Misc queries) 0 November 1st 07 03:56 PM
Is it a comment ? or a label ? or a caption ?.... mars Excel Discussion (Misc queries) 2 May 24th 07 11:15 PM
Load caption box on userform open ExcelMonkey Excel Worksheet Functions 1 April 3rd 07 11:02 PM
Defining UserForm Caption from a Variable [email protected] Excel Worksheet Functions 1 January 3rd 07 02:30 PM
label caption Rod Taylor Excel Programming 2 July 31st 03 03:25 AM


All times are GMT +1. The time now is 03:05 AM.

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"