Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2007

Tip: Looking for answers? Try searching our database.

Opening ASCII Files

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brenda A. Reid - 23 Oct 2007 19:56 GMT
Word XP

I have a macro in WordPerfect that opens an ASCII file so that I can then
convert to a merge file.  The perfect script is:

FileOpen (Filename:"c:\temp\dunning.txt"; Format:ASCIIStandard!)

Word will open the ASCII file but is not displaying it right.  Was wondering
if someone could convert the above to VBA for me . . .

Tks . . .
Shauna Kelly - 24 Oct 2007 10:38 GMT
Hi Brenda

Try something like this:

Dim oDoc as Word.Document

   Set oDoc = Documents.Open _
       (FileName:="plaintextfile.txt", _
       Format:=wdOpenFormatText )

   'you can now do stuff with the oDoc object, eg...
   msgbox oDoc.name

Look up VBA Help under Open to get specific information about the Format
parameter.

By the way, the macro recorder does quite a good job of pointing you to the
objects, methods and properties you need. But you often need to clean up
after it. For info on that, see
How to Modify a Recorded Macro
http://word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

> Word XP
>
[quoted text clipped - 7 lines]
>
> Tks . . .
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.