Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-04-2011, 12:02 PM
smonczka smonczka is offline Macro Delete Selected Text Windows 7 64bit Macro Delete Selected Text Office 2010 32bit
Novice
Macro Delete Selected Text
 
Join Date: Nov 2011
Posts: 1
smonczka is on a distinguished road
Default Macro Delete Selected Text

I am trying to figure out how to create a macro that will delete the selected text in a document.



My document is devided into three sections. I have bookmarked each section separatly and created a macro that will highlight each bookmark.

How do i then delete the highlighted section using a bookmark.
Reply With Quote
  #2  
Old 11-05-2011, 02:12 AM
macropod's Avatar
macropod macropod is offline Macro Delete Selected Text Windows 7 64bit Macro Delete Selected Text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You don't need to select/highlight the bookmarked text to work with it. Try something along the lines of:
Code:
Sub Demo()
ActiveDocument.Bookmarks("BkMk").Range.Delete
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-05-2011, 03:18 AM
macropod's Avatar
macropod macropod is offline Macro Delete Selected Text Windows 7 64bit Macro Delete Selected Text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Cross-posted (and answered) at: http://answers.microsoft.com/en-us/o...5-ee8b1104acc0

For cross-posting etiquette, please read: http://www.excelguru.ca/node/7
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to find text in between two characters and then format selected text? qcom Word 5 02-19-2015 11:23 PM
Mac Word - replace within selected text only. bakerbj Word 0 10-31-2011 11:47 PM
Macro Delete Selected Text Do NOT print selected text Tracy Word 2 09-11-2011 07:25 AM
Selected text and logo in one macro marijke Word VBA 0 08-24-2009 07:01 AM
Help with a macro to shade a selected pie chart hzrvkt Excel 0 02-24-2006 01:25 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:03 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft