Results 1 to 10 of 10

Thread: [RobDog solved it]How to find and delete empty lines in word document

  1. #1

    Thread Starter
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Resolved [RobDog solved it]How to find and delete empty lines in word document

    Maybe my mind got grilled, but somehow I can't make Word find empt lines in order to delete them.
    The plan was/is to look for all double Line-ends and than to dlete one of them.

    Maybe I'm not really used to those 40 degrees C in here.
    Last edited by opus; Oct 6th, 2004 at 10:41 PM.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  2. #2
    New Member
    Join Date
    Sep 2004
    Posts
    3
    Hi,

    For this I usually just go via menu to

    Find and Replace

    Find What: ^p^p

    Replace with: ^p

    Replace All (Maybe run this more than once...)

    This might vary if you mean Manual Line Break instead of Paragraph mark. Go to in Find and Replace to More > Special for list of all possible symbols).

    Hope I got your piont and this can help you!

    jl88

  3. #3

    Thread Starter
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Thanks for the help. I was looking into this menu very deep, but it doesn't work for the document I'm working on( tested all formating possiblities)
    The problem is I have a file that needs to be imported to word, and while importing it gets empty lines between all text lines (something like 2 ^p's, but it's not that). Maybe I have the run thru the file and look for the occasion of double char's and so on.
    I#m still onto that, but in here I've got time...
    PS
    This morning (6 o'clock) running in nice 30 degree C and 65% humidity.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    You can apply this procedure after you import your textfile. It can
    either remove all multiple line spacing or remove multiple line
    spacing from a selected range.

    VB Code:
    1. Public Sub RemoveMultipleEnters()
    2.     'Apply to first paragraph
    3.     ActiveDocument.Paragraphs(1).LineSpacingRule = wdLineSpaceSingle ' Const = 0
    4.     'Or can be applied to a selected paragraph(s)
    5.     Selection.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle ' Const = 0
    6. End Sub
    VB/Outlook Guru!
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Thjanks RobDog but it's not the linespacing.
    I'll attach a zipped example file.
    The thing is, if I create such an example in word, search&replace will do it by deleting (^p^p) with (^p), but it doesn't do it for this special one. We get these files from a specific source, so we have to deal with it.
    Last edited by opus; Jul 18th, 2007 at 02:51 AM.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Ok, got the document. I see what you mean. I will work on it
    tomorrow. Time for bed.

    Later.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Have a nice rest, we're just starting the day.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Ok, GOT IT!
    VB Code:
    1. Public Sub RemoveMultipleEnters()
    2.     'Select the documents contents
    3.     Application.Documents("Example.doc").Select
    4.     'Apply to the selection
    5.     Do While InStr(1, Selection, Chr(13) & Chr(13)) > 0
    6.         Selection.Characters(InStr(1, Selection, Chr(13) & Chr(13))).Delete
    7.     Loop
    8. End Sub
    This will delete the double Enter characters. If its not exatly
    what you need I know that it will only take minimal mods to make
    it leave the document as you want (single chr(13)'s or none at all
    or ???). Getting the mechanics was the hard part.

    HTH

    VB/Outlook Guru!

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Tausend Dank(in english: Many thanks), I couldn't find which Char that thing was, whow did you do it?
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No prob.

    An Enter Key is a Carriage Return or Chr(13) from the old DOS
    days. In Word it displays the Paragraph symbol to represent an
    Enter character (if you have that option turned on). Not too much
    to it oher than finding and replacing.

    Glad to help.


    VB/Outlook Guru!
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width