Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    May 2002
    Location
    Charlotte, North Carolina, USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    If I was hard typing this, I would do the following:
    Ctrl + End (to go the end of the document)
    Backspace
    Delete

    That is what I am trying to accomplish and I have written this, but it is not working:

    Public Sub DeleteSectionBreak()
    Selection.EndKey Unit:=wdStory
    SendKeys ("{BACKSPACE}")
    SendKeys ("{DELETE}")

    End Sub


    Any ideas?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Instead of using SendKeys, you could use

    Selection.EndKey Unit:=wdStory
    Selection.TypeBackspace
    Selection.Delete Unit:=wdCharacter, Count:=1

    although I'm not sure what the Delete would accomplish, since you're at the end of the document.

  3. #3
    Star Lounger
    Join Date
    May 2002
    Location
    Charlotte, North Carolina, USA
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That works, and I got mine to work too, changing it to this:
    Public Sub DeleteSectionBreak()
    Selection.EndKey Unit:=wdStory
    SendKeys "{BS}", True
    SendKeys "{DELETE}", True

    End Sub

    Basically, there is a section break in these documents that is always able to be deleted by doing those exact keystrokes that I am wanting to get rid of.
    Thank you!
    [quote name='HansV' post='795662' date='30-Sep-2009 09:43']Instead of using SendKeys, you could use

    Selection.EndKey Unit:=wdStory
    Selection.TypeBackspace
    Selection.Delete Unit:=wdCharacter, Count:=1

    although I'm not sure what the Delete would accomplish, since you're at the end of the document.[/quote]

Posting Permissions

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