PDA

Click to See Complete Forum and Search --> : Problem in retrieving a degree sign from a form field


yamato
Jan 5th, 2005, 12:49 AM
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.

RobDog888
Jan 5th, 2005, 12:26 PM
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?

yamato
Jan 5th, 2005, 07:42 PM
Thanks for looking into this.

Please see attached image.

http://vb_bug.jpg

Here is the 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.

opus
Jan 6th, 2005, 03:50 PM
Strange?????????
same resultin Windows98SE/ Word 2000/ Language German

RobDog888
Jan 6th, 2005, 10:51 PM
Ok, it must be a .Result thing. Use this instead, it works.
Public Sub d()
MsgBox (ActiveDocument.FormFields(1).Range.Text)
End Sub :thumb:

yamato
Jan 7th, 2005, 11:05 PM
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.


msgbox(ActiveDocument.FormFields(<bookmark name 1>).Range.Text)
msgbox(ActiveDocument.FormFields(<bookmark name 2>).Range.Text)
msgbox(ActiveDocument.FormFields(<bookmark name 3>).Range.Text)

yamato
Jan 8th, 2005, 03:28 AM
Never mind the question above. Problem has been solved. Thanks.