How to insertfile with different encoding

  • Thread starter Inserting dos textfile
  • Start date
I

Inserting dos textfile

When i want to import a textfile in MSWord 2003 i take het following staps:
Insert > file
If the file extention is not recognized there wil be a pop-up to choose the
file coding.
In my case i use MS-DOS because there are several lines drawn in the
document which i want to insert. After inserting the result is ok.

Now i want to do the same in VBA.
I recorded a Macro with the steps above:
Selection.InsertFile FileName:="tweede aanlevering 20091120.tmp",
Range:= _
"", ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.WholeStory
Selection.Font.Size = 6
When i try running the macro the text is imported with the wrong encoding
(lines become garbage). How can i set the encoding to MS-DOS when i use the
insertfile method in vba?
 
D

Doug Robbins - Word MVP

If you change the

ConfirmConversions:=False

to

ConfirmConversions:=True

The dialog in which you can select the method of encoding will be displayed.

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.
 

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