Inserting blank lines into a Range

P

peterA

Hi,

This is a continuation of a prior message which I
accidently hit a hot key and sent...sorry

I'm currently writing code in Access97 to format a Word
document. I have a range(currently the entire document)
and am trying to replace and format this document based on
values in a source doument. Within this range, I'm trying
to move to the end of some text I've just inserted within a
range, and and insert a blank line. When I record the
macro in Word it looks like this:
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.TypeParagraph
I'm just not clear on how to accomplish this from Access,
having a Word object open. Should I use a range object?
When I try to insert a blank line, the text I just pasted
gets overwritten....

Any ideas? Thanks!!
 
J

Jay Freedman

Hi, Peter,

Using empty paragraphs (hitting Enter twice) is a very poor method of
spacing -- using styles with paragraph formatting of Space After is
preferable for simplifying document maintenance -- but it can be painful to
do programmatically from another app. So, without further sermons:

Replace the EndKey line with

Selection.Collapse wdCollapseEnd

If Access VBA complains that it doesn't have a definition for the constant
wdCollapseEnd, use this instead:

Selection.Collapse 0
 

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