OwnStatus and StatusText

C

Cifly

Hej NG

I try to set the text in my formfield as follows:

Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormDropDown
Selection.PreviousField.Select
With Selection.FormFields(1)
.Name = PRIONavn
.EntryMacro = ""
.ExitMacro = "Makro2"
.Enabled = True
.OwnHelp = False
.HelpText = ""
.OwnStatus = True
.StatusText = "Choose"
End With

But the field is absolutely empty.

Can anyone cast some light over my problem?

Cifly
 
D

Doug Robbins - Word MVP

You need quotation marks around "PRIONav" and there must be a macro with the
name "Makro2" or the operation will fail.

Of course, at this stage, no items have been added to the DropDown list so
there is nothing from which to choose.

Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormDropDown
Selection.PreviousField.Select
With Selection.FormFields(1)
.Name = "PRIONavn"
.EntryMacro = ""
.ExitMacro = "Makro2"
.Enabled = True
.OwnHelp = False
.HelpText = ""
.OwnStatus = True
.StatusText = "Choose"
End With

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Cifly

Doug Robbins - Word MVPwrote:
You need quotation marks around "PRIONav" and there must be a macro with
the name "Makro2" or the operation will fail.

Of course, at this stage, no items have been added to the DropDown list so
there is nothing from which to choose.

Oh, forgot to mention. PRIONavn is a variable, so there should'nt be
quotation marks around it, i figure.

And even if there isn't any contents in the dropdown, it should show the
text that i told it to, i imagine.

But then again - iøm not sure.

Anyway - i tryed with contents in the dropdown - it still didn't do what i
had in mind.
 
D

Doug Robbins - Word MVP

The following works for me, creating a DropDown formfield with the name of
Dropdowntest:

Dim PRIONavn As String
PRIONavn = "Dropdowntest"
Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormDropDown
Selection.PreviousField.Select
With Selection.FormFields(1)
.Name = PRIONavn
.EntryMacro = ""
.ExitMacro = "Makro2"
.Enabled = True
.OwnHelp = False
.HelpText = ""
.OwnStatus = True
.StatusText = "Choose"
End With

Note however that the string assigned to .StatusText is displayed in the
Status Bar when the formfield has the focus (when the document is protected
for forms)
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Cifly

Doug said:
The following works for me, creating a DropDown formfield with the name of
Dropdowntest:

Dim PRIONavn As String
PRIONavn = "Dropdowntest"
Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormDropDown
Selection.PreviousField.Select
With Selection.FormFields(1)
.Name = PRIONavn
.EntryMacro = ""
.ExitMacro = "Makro2"
.Enabled = True
.OwnHelp = False
.HelpText = ""
.OwnStatus = True
.StatusText = "Choose"
End With

Note however that the string assigned to .StatusText is displayed in the
Status Bar when the formfield has the focus (when the document is
protected for forms)

Strange. It dosn't do the trick for me. But this time, i tried with this

ActiveDocument.FormFields(PRIONavn).Result = "Choose"

That did it. So now i got it to work, but not the usual way.

Thanks anyway for your great support.
 
D

Doug Robbins - Word MVP

As I mentioned in my previous post, the string that is assigned to the
StatusText property of a formfield is displayed in the Status Bar (at the
bottom left of the screen) when the document is protected for forms and the
formfield is the active formfield. It is NOT displayed in the formfield.

The .Result property of a formfield on the other hand can be used to set a
value (string) that is displayed in the formfield itself.

They are NOT the same thing.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top