Ask the Expert

Creating a "wrap text" format in Excel VBA

Is there any way to programmatically create an Excel spreadsheet defining a column with "wrap text" format? I have searched the SAP library, but the results were discouraging.

    Requires Free Membership to View

In Excel VBA, to set a column, e.g., D to "Wrap Text", you use:
Columns("D:D").WrapText = True

To do this in ABAP, you'd need to create an OLE Excel object, using (omitting definitions) something like:

CREATE OBJECT o_wks 'Excel.Application' NO FLUSH. 
GET PROPERTY OF o_wks 'Range' = o_rng1 NO FLUSH exporting #1 = 'D:D'. 
SET PROPERTY OF o_rng1 'WrapText' = '1'. 

This was first published in November 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: