Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Sep 2007
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post

    Macro to do what TXt Only with Line Breaks used to (English/Word/2003)

    I am trying to do a macro that will enable me to do what the Save as Txt only with line breaks used to do. I can't find that converter anywhere for Word 2003, so if its there, and you know how I can get it, that would solve all my problems. However, in the office, we have to upload a document to Corporate Registries that has line breaks at the end of each line. Otherwise, the paragraph runs on forever until it hits a paragraph mark and Corporate Registries won't accept it. I need to be able to program a macro that will enable me to put in so much text and then add paragraph marks at the end of each line. Does anyone know how I can do that?

    Thanks so much for your help.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Macro to do what TXt Only with Line Breaks use

    I used to use this for something, but I can't recall what. It type a paragraph at the end of every line using the current margins. It probably will have difficulties with bullet/number formatting, and block-indented paragraph, but otherwise it might do want you need. Of course, don't save over your original file...

    <code>Sub HardWrap()
    With Selection
    .HomeKey wdStory, wdMove
    .EndKey wdLine, wdMove
    While .End < ActiveDocument.Range.End - 2
    If .Text = Chr(13) Then
    .MoveRight wdCharacter, 1, wdMove
    Else
    .TypeParagraph
    End If
    .EndKey wdLine, wdMove
    Wend
    End With
    End Sub</code>

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to do what TXt Only with Line Breaks used to (English/Word/2003)

    You can still save as a text file with line breaks. If you use File | Save As... and select Plain Text as file type, you should get a File Conversion dialog with a check box 'Insert Line Breaks'.

    The VBA equivalent of this is

    ActiveDocument.SaveAs FileName:="Blahblah.txt", FileFormat:=wdFormatText, InsertLineBreaks:=True

  4. #4
    Star Lounger
    Join Date
    Sep 2007
    Posts
    54
    Thanks
    7
    Thanked 1 Time in 1 Post

    Re: Macro to do what TXt Only with Line Breaks used to (English/Word/2003)

    Got it. Thank you so much for your help. Worldox (our document management system) does not allow the pop up to come up. The VBA code fixed everything. Thanks so much.

Posting Permissions

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