From: Worsty on
In my word form which I am using all form fields with the exception of
a submit button. I'd like to know if there is a way to "disable" a
button (submit for ex:) until a specific criteria is met.

So basically, if activedocument.formfield("tesxt1").result = "ready to
submit" then
.....submit button.enabled = true else
......submit button. enabled = false

can someone help me out with the commandbutton reference code.

Thanks much!
From: Fumei2 via OfficeKB.com on
Assuming the commandbutton is an ActiveX control, you simply have to exit its
Click event, like this:

Option Explicit

Private Sub CommandButton1_Click()
If ActiveDocument.FormFields("Text1").Result = "" Then
MsgBox "Formfield is blank!"
Exit Sub
Else
MsgBox ActiveDocument.FormFields("Text1").Result
" or whatever else you are doing
End If
End Sub

Worsty wrote:
>In my word form which I am using all form fields with the exception of
>a submit button. I'd like to know if there is a way to "disable" a
>button (submit for ex:) until a specific criteria is met.
>
>So basically, if activedocument.formfield("tesxt1").result = "ready to
>submit" then
> .....submit button.enabled = true else
>.....submit button. enabled = false
>
>can someone help me out with the commandbutton reference code.
>
>Thanks much!

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/201001/1

From: Fumei2 via OfficeKB.com on
Or, to be more specific to your request...

Private Sub CommandButton1_Click()
If ActiveDocument.FormFields("Text1").Result <> "ready to submit" Then
MsgBox "Invalid input in formfield!"
Exit Sub
Else
MsgBox ActiveDocument.FormFields("Text1").Result
" or whatever else you are doing
End If
End Sub

Although, it does seem a little odd to put "ready to submit" into a text
formfield in order to execute a commandbutton.

Fumei2 wrote:
>Assuming the commandbutton is an ActiveX control, you simply have to exit its
>Click event, like this:
>
>Option Explicit
>
>Private Sub CommandButton1_Click()
>If ActiveDocument.FormFields("Text1").Result = "" Then
> MsgBox "Formfield is blank!"
> Exit Sub
>Else
> MsgBox ActiveDocument.FormFields("Text1").Result
> " or whatever else you are doing
>End If
>End Sub
>
>>In my word form which I am using all form fields with the exception of
>>a submit button. I'd like to know if there is a way to "disable" a
>[quoted text clipped - 8 lines]
>>
>>Thanks much!

--
Message posted via http://www.officekb.com

From: Worsty on
On Jan 20, 1:28 pm, "Fumei2 via OfficeKB.com" <u53619(a)uwe> wrote:
> Or, to be more specific to your request...
>
> Private Sub CommandButton1_Click()
> If ActiveDocument.FormFields("Text1").Result <> "ready to submit" Then
>    MsgBox "Invalid input in formfield!"
>    Exit Sub
> Else
>    MsgBox ActiveDocument.FormFields("Text1").Result
>    " or whatever else you are doing
> End If
> End Sub
>
> Although, it does seem a little odd to put "ready to submit" into a text
> formfield in order to execute a commandbutton.
>
>
>
>
>
> Fumei2 wrote:
> >Assuming the commandbutton is an ActiveX control, you simply have to exit its
> >Click event, like this:
>
> >Option Explicit
>
> >Private Sub CommandButton1_Click()
> >If ActiveDocument.FormFields("Text1").Result = "" Then
> >   MsgBox "Formfield is blank!"
> >   Exit Sub
> >Else
> >   MsgBox ActiveDocument.FormFields("Text1").Result
> >   " or whatever else you are doing
> >End If
> >End Sub
>
> >>In my word form which I am using all form fields with the exception of
> >>a submit button.  I'd like to know if there is a way to "disable" a
> >[quoted text clipped - 8 lines]
>
> >>Thanks much!
>
> --
> Message posted viahttp://www.officekb.com- Hide quoted text -
>
> - Show quoted text -

***************************************************

Thanks for your reply.

I was Just using the text to fill in the result with something.

What I want to do is "disable" the commandbutton1. Is there a way to
do this?