Solved

How to clear contents of a Word document prgrammatically

Posted on 1998-01-05
4
315 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
  • 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Article by: dandraka
There are several quick shortcuts that can make your life easier in Microsoft Programs.  These simple tips and tricks will your work more productive and you faster at completing your tasks! MS Word (1) Creating Re-usable Scraps You can create s…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now