insert field in word 2003

M

mayberryman

my macro in word 2000 works perfectly...inserting, among other things, the plus minus symbol (alt 0177 ±)
however, when my macro runs in word 2003 everything works properly except the plus minus symbol is converted to some type of japenes symbol. The field is inserting a small text file when this occurs. If I manually do it, I'm offered the option of windows (default) - which it does not default to, and 2 more options one of which is the Japenese symbol. If i choose windows default, it works properly. However I've been unable to come up with a way to have my macro automatically select the windows default. any help would be appreciated.
 
B

Beth Melton

If you recorded using Insert/Symbol then I suspect it is picking up
the font, Unicode, etc.

In your macro use:
Selection.TypeText Text:="±"


--
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/


mayberryman said:
my macro in word 2000 works perfectly...inserting, among other
things, the plus minus symbol (alt 0177 ±)
however, when my macro runs in word 2003 everything works properly
except the plus minus symbol is converted to some type of japenes
symbol. The field is inserting a small text file when this occurs.
If I manually do it, I'm offered the option of windows (default) -
which it does not default to, and 2 more options one of which is the
Japenese symbol. If i choose windows default, it works properly.
However I've been unable to come up with a way to have my macro
automatically select the windows default. any help would be
appreciated.
 
M

mayberryman

Thank you for your response :) The pertinent section of my macro is below...

Selection.InsertFile filename:="C:\temp\" + filename + ".TeX", Range:="", ConfirmConversions
:=False, Link:=False, Attachment:=Fals

It is opening a text file (ignore the fact that the extension is .TeX) and inserting it into a word document. The text file can be opened in notepad (for example) and it can be verified that the ± symbol is present

And, if I manually insert the text file in a word doc (between the {} using alt-F9) I'm offered the option to select windows (default). If I select it, the text file with the ± is inserted and displays correctly

However, if my macro inserts the text file (using my code above) it all inserts correctly except the ± symbol is converted to some type of japenese character

Is there a way, in my macro, to specify 'something' which would make word 2003 behave the way word 2000 did? I can run this same macro in word 2000 and it works perfectly hundreds of times.

As you can see, my problem is not just inserting a ± symbol, but having it inserted correctly when it appears in the text file which is being inserted

Thanks for any guidance you can provide


----- Beth Melton wrote: ----

If you recorded using Insert/Symbol then I suspect it is picking u
the font, Unicode, etc

In your macro use
Selection.TypeText Text:="±


--
Please post all follow-up questions to the newsgroup. Requests fo
assistance by email can not be acknowledged

~~~~~~~~~~~~~~
Beth Melto
Microsoft Office MV

Word FAQ: http://mvps.org/wor
TechTrax eZine: http://mousetrax.com/techtrax
MVP FAQ site: http://mvps.org


mayberryman said:
my macro in word 2000 works perfectly...inserting, among othe
things, the plus minus symbol (alt 0177 ±
however, when my macro runs in word 2003 everything works properl
except the plus minus symbol is converted to some type of japene
symbol. The field is inserting a small text file when this occurs
If I manually do it, I'm offered the option of windows (default)
which it does not default to, and 2 more options one of which is th
Japenese symbol. If i choose windows default, it works properly
However I've been unable to come up with a way to have my macr
automatically select the windows default. any help would b
appreciated
 
B

Beth Melton

Now I understand what you are encountering. The text file is
interpreted as encoded text and the wrong converter is being used.

I do not think the InsertFile method allows for selecting the
converter. You may need to change the ConfirmConversions parameter to
True to cause the Confirm Conversion dialog to display so you can make
the correct selection.

You might be able to use the IncludeText field since it has the
ability to specify a converter. Something like:

{INCLUDETEXT "C:\temp\" + filename + ".TeX" \c text}

And then break the link using: Selection.Fields.Unlink

Otherwise you might try posting in one of the Word VBA newsgroups to
see if they have any other ideas.
--
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/


mayberryman said:
Thank you for your response :) The pertinent section of my macro is below....

Selection.InsertFile filename:="C:\temp\" + filename + ".TeX",
Range:="", ConfirmConversions _
:=False, Link:=False, Attachment:=False


It is opening a text file (ignore the fact that the extension is
..TeX) and inserting it into a word document. The text file can be
opened in notepad (for example) and it can be verified that the ±
symbol is present.
And, if I manually insert the text file in a word doc (between the
{} using alt-F9) I'm offered the option to select windows (default).
If I select it, the text file with the ± is inserted and displays
correctly.
However, if my macro inserts the text file (using my code above) it
all inserts correctly except the ± symbol is converted to some type of
japenese character.
Is there a way, in my macro, to specify 'something' which would make
word 2003 behave the way word 2000 did? I can run this same macro in
word 2000 and it works perfectly hundreds of times.
As you can see, my problem is not just inserting a ± symbol, but
having it inserted correctly when it appears in the text file which is
being inserted.
 
M

mayberryman

thanks for your efforts...so far, a post to microsoft.vb.ole.automation has not yeilded any response. any particular newsgroups you'd recommend?
 
B

Beth Melton

You might try microsoft.public.word.vba.general.

--
Please post all follow-up questions to the newsgroup. Requests for
assistance by email can not be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/


mayberryman said:
thanks for your efforts...so far, a post to
microsoft.vb.ole.automation has not yeilded any response. any
particular newsgroups you'd recommend?
 

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