From: kennkh on
Depending on what your Word Object is named (You should have a list in your
project window under Microsoft Word Objects), it should look something like:

ThisDocument.submitbutton.enabled = true

If your button exists in ThisDocument

"Worsty" wrote:

> 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?
> .
>
From: Fumei2 via OfficeKB.com on
The following MUST be in the ThisDocument code module. Use it as the OnExit
macro for the formfield "Test1".

Sub Test1ExitMacro()
If ActiveDocument.FormFields("Test1").Result <> _
"Ready to submit" Then
CommandButton1.Enable = False
End If
End Sub

Although I still think it is very odd to do this. The chance of error seems
high. At the very least use a DropDown so they can select a "Ready to
submit" rather than having to type it in a textbox. Remember, ANY error at
all will disable the commandbutton. What if they inadvertantly put an extra
space at the end: "Ready to submit "; or an extra space between the words:
"Ready to submit"; or any possible spelling error; "Ready to suvmit"


kennkh wrote:
>Depending on what your Word Object is named (You should have a list in your
>project window under Microsoft Word Objects), it should look something like:
>
>ThisDocument.submitbutton.enabled = true
>
>If your button exists in ThisDocument
>
>> > Or, to be more specific to your request...
>> >
>[quoted text clipped - 46 lines]
>> do this?
>> .

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