5904 - Cannot Edit Range

B

Blackberry

Hi All

I'm looping an array of text into a number of cells in 1 x MS Word table via
my VB6 app.

To make sure each text value is on a new line of the table cell I put a
carriage return/paragraph marker after it.
To start with I used oDoc.Range.Text = oDoc.Range.Text & vbCrLf, but for
some reason this always creates an extra return/blank line.

So not to be out-done by this I thought I would use the
oDoc.Range.InsertParagraph or oDoc.Range.InsertParagraphAfter commands, but
for some reason even though the loop works fine for all of the other values
the last text value to be put into the table always causes this 5904 error.

Any ideas?
 
R

Rick Rothstein \(MVP - VB\)

I'm looping an array of text into a number of cells in 1 x MS Word table
via
my VB6 app.

To make sure each text value is on a new line of the table cell I put a
carriage return/paragraph marker after it.
To start with I used oDoc.Range.Text = oDoc.Range.Text & vbCrLf, but for
some reason this always creates an extra return/blank line.

What happens if you use either vbCr or vbLf instead of vbCrLf?

By the way, did you miss Robert Morley's post over in your other thread?
Here is what he said over there...

Just FYI, the groups...

microsoft.public.vb.enterprise and
microsoft.public.vb.general.discussion

....are definitely the wrong groups for Word VBA questions, and most people
there won't know the answers to your question. Those groups are for VB6 and
below. I see you've also posted to a couple of Word VBA groups and gotten
some responses. Those are he correct place.
 
R

Russ

Hi,
See below.
Hi All

I'm looping an array of text into a number of cells in 1 x MS Word table via
my VB6 app.

To make sure each text value is on a new line of the table cell I put a
carriage return/paragraph marker after it.
To start with I used oDoc.Range.Text = oDoc.Range.Text & vbCrLf, but for
some reason this always creates an extra return/blank line.
Can you use vbCR instead of vbCRLf?
 
B

Blackberry

Hi Russ

Sorry to sound a bit dim, but what should I be looking at?


Hi,
See below.
Hi All

I'm looping an array of text into a number of cells in 1 x MS Word table
via
my VB6 app.

To make sure each text value is on a new line of the table cell I put a
carriage return/paragraph marker after it.
To start with I used oDoc.Range.Text = oDoc.Range.Text & vbCrLf, but for
some reason this always creates an extra return/blank line.
Can you use vbCR instead of vbCRLf?
 
R

Rick Rothstein \(MVP - VB\)

The one line that didn't start with a "previous message line" symbol. In
this case...

Can you use vbCR instead of vbCRLf?

(It was hard to see because there were no blanks lines separating from the
rest of the text.)

Rick
 
J

Jeff Johnson

The one line that didn't start with a "previous message line" symbol. In
this case...

Can you use vbCR instead of vbCRLf?

(It was hard to see because there were no blanks lines separating from the
rest of the text.)

Agreed. White space is your friend, folks.

(And proliferating unnecessary cross-posting is FUN!!)
 

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