For Next help needed

D

Drake

Hi - I have the following script that isn't work right. It is supposed to
go to the bookmark, determine how many lines are left on the page, and enter
a paragraph symbol for the number of lines that are the difference between
where it is and the end of the page. Any thoughts?
-----------------

Sub signature()

Selection.GoTo What:=wdGoToBookmark, name:="otherinfo"

numoflines = Selection.Information(wdFirstCharacterLineNumber)

For lngindex = 1 To CInt(43 - numoflines)
Selection.TypeParagraph
Next
Selection.EndKey Unit:=wdStory
Selection.Paste

End Sub
 
J

Jezebel

What are you actually trying to do? What are you pasting, and is that meant
to be part of your routine?

But as a general principle, don't fill your document with empty paragraphs.
 
D

Drake

Hi Jezebel - thanks for the response. What I am trying to do is copy the
signature line from a document and move it to the end of the document.
Where I copy it from will vary, depending on the document. It works with
most documents, but not with two of them. I am trying to figure out what is
the deal with the two, but thought there might be a better way to do it.
 
J

Jezebel

Define an autotext entry that contains the signature in a textbox that is
positioned absolutely, in the right position on the page. Then in your macro
insert it the autotext entry, anchored to the last paragraph in the
document. The last paragraph is necessarily on the last page, so you
signature will end up at the bottom of it.
 
D

Drake

Before the macro starts, the document is two pages long. Then, the macro
drops in assorted autotext that makes the doc anywhere from 3 to 7 pages.
The last paragraph prior to pasting the signature could be at the top,
middle, or end of the last page. Since I don't know that ahead of time, I
thought inserting the empty paragraphs was the only option to get it to the
end of the page.
 
J

Jezebel

Inserting multiple paragraphs is NEVER a good way to position things. In
this case, all you need to know is that the last paragraph is ON the last
page. Set up the signature so that it is a floating graphic, positioned (eg)
2cm from left of page, 25cm from top.
 
D

Drake

That sounds great. How do I do that?


Jezebel said:
Inserting multiple paragraphs is NEVER a good way to position things. In
this case, all you need to know is that the last paragraph is ON the last
page. Set up the signature so that it is a floating graphic, positioned
(eg) 2cm from left of page, 25cm from top.
 

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