Turning off Word-Wrap

W

WillisCat

If I write
Cells(3, 5).Value2 = :"a very long string of characters"
in Excel VBA, the result is that string of characters stored in cell
E3. Because the string is longer than the width of the cell, it
extends out of the cell into the cells to the right, if those cells
have no values. If I subsequently format the cell to be right-aligned,
the text begins in a cell to the left of E3. Just what I would expect.

However, if I do the same thing with a C++ program using OLE
automation, the long string is word-wrapped in cell E3 and the height
of row 3 is increased to contain the word-wrapped text.

Any idea why I get different results when the automation is controlled
by a C++ program rather than VBA? And more importantly, how can I
prevent this from happening?

I've tried using Value as well as Value2 and I've tried setting the
WordWrap property to False. No successes yet.

Willis
 
S

spilly39

I really have no experience, but I'd start looking at the cell formatting
properties in the two environments - Cell.WrapText is a boolean
 

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