|
-
Jan 3rd, 2001, 08:52 AM
#1
Thread Starter
Addicted Member
i am trying to create a program in vb which inputs some text in a word document. What i want to do is some how delete eveything that is on page 2 onwards, leaving only the contents of page 1 in that document.
I have tried to use the macro in the word. but there is no way of doing this as i only have an option to select all.
any suggestions ????
-
Jan 4th, 2001, 06:59 AM
#2
Addicted Member
Yes, here's a suggestion:
Record a macro. Do what you want to do manually. Stop recording and look at the recorded code.
To do what you want to do, Record a macro (Macro1).
1) Press Ctrl + Home to go to the very top of the doc.
2) Press Ctrl + PgDown to go to the start of the next page (Page 2).
3) Press Shift + Ctrl + End to select everything to the end of the document.
4) Press Delete to delete the selection.
Stop Recording. Go to macros and "Edit" the macro that you have just recorded. The coding that you see will look something like this:
Code:
Selection.HomeKey Unit:=wdStory
Application.Browser.Next
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Hope this helps.
Shrog
VB6 Ent SP5
Win2000 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|