Problem in retrieving a degree sign from a form field
I am having problems when retrieving a degree sign in a ms word form field.
It seems that the degree sign which should have a value of 176 is being converted to a space(32). Although the character can be displayed in the field, after calling ActiveDocument.FormFields(<index>).Result, the char turns into a space. Is there a workaround to this?
Thanks.
1 Attachment(s)
Re: Problem in retrieving a degree sign from a form field
Welcome to the Forums.
Maybe there is something else going on because I can display and retrieve
the degree symbol from both a userform textbox and a form field textbox.
Can you post some of the involved code?
1 Attachment(s)
Re: Problem in retrieving a degree sign from a form field
Thanks for looking into this.
Please see attached image.
http://vb_bug.jpg
Here is the code.
VB Code:
Public Sub d()
MsgBox (ActiveDocument.FormFields(1).Result)
End Sub
I have tried this in different environments.
Word 2000 and Windows 2000 - Both English
Word XP and Windows XP - Both Chinese
Word 2003 and Windows XP - Both Chinese
The bug exists in all three.
Thanks again.
Re: Problem in retrieving a degree sign from a form field
Strange?????????
same resultin Windows98SE/ Word 2000/ Language German
Re: Problem in retrieving a degree sign from a form field
Ok, it must be a .Result thing. Use this instead, it works.
VB Code:
Public Sub d()
MsgBox (ActiveDocument.FormFields(1).Range.Text)
End Sub
:thumb:
Re: Problem in retrieving a degree sign from a form field
Thanks.
I tried it and it works, but only for the first field. All fields after the first returns "". Let's say I have 3 bookmarks.
VB Code:
msgbox(ActiveDocument.FormFields(<bookmark name 1>).Range.Text)
msgbox(ActiveDocument.FormFields(<bookmark name 2>).Range.Text)
msgbox(ActiveDocument.FormFields(<bookmark name 3>).Range.Text)
Re: Problem in retrieving a degree sign from a form field
Never mind the question above. Problem has been solved. Thanks.