Solved

How to clear contents of a Word document prgrammatically

Posted on 1998-01-05
4
326 Views
Last Modified: 2012-06-27
I would like to clear the contents of a the active document via macro function. I cannot find a command such as "activedocument.clear" or something like this. What is available for me?
0
Comment
Question by:englm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:bigelos
ID: 1607031
Try this macro (assuming you have the active document selected).

Sub MAIN
EditSelectAll
EditClear
End Sub

0
 

Author Comment

by:englm
ID: 1607032
The 'editselectall' function does not work when I use it in a subroutine. I selected my text using the activedoc.range parameters. I cannot find any references to 'editselectall' or 'editclear' in the docummentation.

Also, I don't have to necessarily run this form a macro. It can be executed from a subroutine on a userform if this makes a difference.
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1607033
What version of Word are you using?  
EditSelectAll and EditClear are both WordBasic commands in Word 7.0.


0
 
LVL 10

Accepted Solution

by:
rbr earned 50 total points
ID: 1607034
Use

Selection.WholeStory
Selection.Cut
0

Featured Post

SuperAntiSpyware Licenses Discounted by 25% !

Exclusive offer to Experts Exchange Members!
Buy SuperAntiSpyware License(s) from us and save 25% on the regular purchase price.
- Includes Full SuperAntiSpyware Vendor Support Entitlements
- Your Subscription does not begin until you activate your license
- Buy for your friends

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question