New Page

J

James O

Hello all,

Quick question, I have a word template that I put pictures into, I am try to
make a macro that inserts a page at the top of the document and then copies
all the info from the page below it. I have been trying to record a macro but
I have met with little success other than making a new pages, I somhow get
portions of the page copied. Not sure if records some of the hitkeys I am
using. I know VB6 but thats not helping much hehe. Thanks!
 
J

James O

the first 2 llines are to get the cursor to the upper right hand corner
as a starting point.

Selection.MoveUp Unit:=wdLine, Count:=25
Selection.MoveLeft Unit:=wdCharacter, Count:=18
Selection.HomeKey Unit:=wdLine
Selection.InsertBreak Type:=wdPageBreak
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.MoveLeft Unit:=wdCharacter, Count:=2
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.HomeKey Unit:=wdLine
Selection.MoveDown Unit:=wdLine, Count:=10, Extend:=wdExtend
Selection.Copy
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.PasteAndFormat (wdPasteDefault)
Selection.MoveUp Unit:=wdLine, Count:=6, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
 
T

Tony Strazzeri

See if the following code helps you to get started.

Selection.HomeKey Unit:=wdStory
Selection.InsertBreak Type:=wdPageBreak
Selection.MoveDown Unit:=wdLine, Count:=12, Extend:=wdExtend
Selection.Copy
Selection.HomeKey Unit:=wdStory
Selection.PasteAndFormat (wdPasteDefault)

This copies from the top left corner (I noticed later that you are
going to the top right).
When recording macros it is easier to use keyboard shortcuts that give
th greatest amount of movement with the least keystrokes. ie avoid
using multiple cursor movements in favour of (say) Ctrl+rightArrow to
move to the next word. You should have a look at the various keyboard
shortcuts to move around the document. This will give more concise
recorded code.

Hope this helps.

Cheers
TonyS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top