+ Reply to Thread
Results 1 to 11 of 11

Convert Notepad to word documents ( from .txt to .doc files )

  1. #1
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    633

    Convert Notepad to word documents ( from .txt to .doc files )

    Dear All,
    I have more than 100 notepad files (.txt). I need to convert all these notepad files to word files(.doc) at a time . I will be happy if I get any macro to solve my issue.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,360

    Re: Convert Notepad to word documents ( from .txt to .doc files )

    I have to ask a) why would you want to do that? and b) why would you want to do it in Excel?

    Word can open .txt files and you can make MS Word the default assignment for .txt files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    633

    Re: Convert Notepad to word documents ( from .txt to .doc files )

    Hi TMS , Thanks for reply

    a) We have a server & every day this server generate more than 100 text file automatically . these file contains some networks related information. Now I am to upload these file to web portal but the web portal does not support .txt file . it support only documents file not .txt file. That’s way what I am currently doing , one by one open that notepad file & save as .doc

    b) I thought there might be a solution of macro . maybe there have some DOS command that will be implemented inside the macro module to solve the task

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Convert Notepad to word documents ( from .txt to .doc files )


    Hi !

    Nothing to do here as an Excel forum so try on the Word section …

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,360

    Re: Convert Notepad to word documents ( from .txt to .doc files )

    Excel does not contain a feature for converting an Excel file into a Word file, and Word cannot directly open Excel files. However, an Excel table can be copied and pasted into Word and then saved as a Word document.

    So, you'd need to open the .txt file in Excel, select the data and convert it into a Table. Then open a new Word document, copy the Table from Excel and Paste it into Word. Name, Save and Close the new Word document. And you'd need to make that into a loop to pick up all the .txt files.

    You can read the whole text file into a string variable and then paste that into a Word document

    Please Login or Register  to view this content.
    Courtesy: http://codevba.com/office/read_text_...m#.XNrPvPZFzIU

    I guess that would miss out a couple of stages


    Can't help thinking you'd be better off getting someone with Word VBA skills to do this for you. You should be able to use the same VBA code in Word.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,360

    Re: Convert Notepad to word documents ( from .txt to .doc files )

    Ok, this demonstrates the process. You'll need some code to get your list of files but there are lots of examples of using Dir, etc., to loop through files in a folder.

    Please Login or Register  to view this content.

    I'm no expert and this is cobbled together from examples I've researched. It is tested and it does work. It's just missing the "front end" to process the .txt files in a folder.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,360

    Re: Convert Notepad to word documents ( from .txt to .doc files )

    This will be better for linking to a front end process:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    633

    Re: Convert Notepad to word documents ( from .txt to .doc files )

    Quote Originally Posted by TMS View Post
    This will be better for linking to a front end process:

    Please Login or Register  to view this content.
    Hi TMS , It is showing below error


    Compile error

    User-defined type not define

  9. #9
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    633

    Re: Convert Notepad to word documents ( from .txt to .doc files )

    Hi TMS, Finally I got the solution for changing file format from .txt to .doc with the help of command prompt. here is the DOS command prompt.

    Please Login or Register  to view this content.
    Is it possible to run this small DOS command through Excel macro? If not possible then I will close the thread as one solution already got. Again thanks for trying to help me.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,360

    Re: Convert Notepad to word documents ( from .txt to .doc files )

    You will need a reference to MS Word … that will make the Compile Error go away.

    Why would you want to run a single line DOS Command from Excel?

    You might as well create a DOS Batch file and run that.

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,360

    Re: Convert Notepad to word documents ( from .txt to .doc files )

    Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Generate Multiple Word Documents from Multiple Excel Files
    By TellerFarsight in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-05-2018, 12:58 PM
  2. Convert Word Documents in a folder to PDF
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-24-2014, 12:23 PM
  3. Convert multiple word files into pdf
    By bruce71101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2013, 06:09 AM
  4. How to create multiple word documents using data from multiple excel files.
    By Milan Kotus in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-14-2013, 12:07 PM
  5. convert all 97-2003 excel documents to macro enabled documents on server
    By viperisback in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-23-2013, 09:06 AM
  6. Inserting multiple excel files into multiple word documents
    By lwaldron in forum Word Programming / VBA / Macros
    Replies: 11
    Last Post: 10-02-2012, 05:34 AM
  7. how do I convert Works DB files to Word
    By Geranium Jane in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 01-19-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1