Click to See Complete Forum and Search --> : how do i this???
iissa
Jan 3rd, 2001, 07:52 AM
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 ????
Shrog
Jan 4th, 2001, 05:59 AM
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:
Selection.HomeKey Unit:=wdStory
Application.Browser.Next
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Hope this helps.
Shrog
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.