Suman
Suman

Reputation: 93

Problem in printing multiline sentence through VBA in excel

I want to print a 4 to 5 line sentence in excel using VBA .like if i print onle line sentence as " Delhi is the Capital of India", it is working. But same format don't work for multiline sentence.

Please help me out on this.

Upvotes: 0

Views: 794

Answers (1)

Alain
Alain

Reputation: 27220

It isn't clear what problem you are having, but here's a few things to note about using line breaks in excel:

  • Line breaks that have been pasted into a cell will sometimes appear as a hollow rectangle if 'Wrap Text' is not enabled for the cell. You can find this function under the Text Alignment menu.
  • If a line break is inserted into a cell and the text is wrapping correctly, only the first line will appear unless you increase the row height to make the text visible. The easiest way to do this is to double click the bottom divider of the row header.
  • When printing excel documents, only the visible area of cells will be printed. The document is a 'what you see is what you get' in terms of printing, so if rows or columns aren't sized to display the entire contents of cells, then that content will not appear when the document is printed.
  • In VBA, you add a line break to a string using the constant VBNewLine. You add it by concatenation, so you would separate your two lines using Selection.Value = "First Line" + VBNewLine + "Second Line."

Hope one of these solves your problem.

Upvotes: 2

Related Questions