Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jun 2015
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Need MS Word macro help

    URGENT! help required Please

    Hello there! I am new to Macros and to the forum and could do with some help if anyone can give any. I hope I have posted/ am asking in the right place.

    I am trying to make my MS Word Macro that can copy the a document, make a new doc. populated with every second word from the first document. I know this may sound simple or silly but I am greatly confused and any assistance would be very gratefully appreciated.

    Thank you for reading and especially thank you very much if you think you can help.
    Last edited by AJ199; 2015-06-06 at 11:15. Reason: poor grammar initially, content unclear

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    The easiest way to do this is to create a copy of the document and then delete every second word.

    Word has a Word object but this seems to include things that (in my way of thinking) may not actually be 'words' like punctuation marks. Also, for the purpose of this macro, I'll assume you want to get rid of every second Word regardless of the paragraphs. A basic macro to do the task might be
    Code:
    Sub EverySecondWord()
      Dim aDoc As Document, lngWord As Long
      Set aDoc = Documents.Add(Template:=ActiveDocument.FullName)
      With aDoc
        For lngWord = .Words.Count To 1 Step -2
          .Words(lngWord).Delete
        Next lngWord
      End With
    End Sub
    This macro should get you started but it will give you a patchy result because of the punctuation = word behaviour so you will probably need to manage that too but I don't want to do all your homework for you.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. The Following User Says Thank You to Andrew Lockton For This Useful Post:

    AJ199 (2015-06-07)

  4. #3
    New Lounger
    Join Date
    Jun 2015
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Haha, understandable thank you, that should be a good basis to begin with. Also fortunately there is not too much punctuation.

Tags for this Thread

Posting Permissions

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