Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to clear contents of a Word document prgrammatically

Posted on 1998-01-05
4
Medium Priority
?
342 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 150 total points
ID: 1607034
Use

Selection.WholeStory
Selection.Cut
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
New style of hardware planning for Microsoft Exchange server.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

783 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