Link to home
Start Free TrialLog in
Avatar of ammox2000
ammox2000

asked on

VB to Excel Autofit Problem

Hi

Take a look at following statement:

strTempAddr = strTempAddr & Trim(objAddr.Fields("Bldg_Name")) & " " _
       & Trim(objAddr.Fields("Area")) & " " & Trim(objAddr.Fields("Landmark")) _
       & vbNewLine & Trim(objAddr.Fields("City")) & " " & Trim(objAddr.Fields("District")) _
       & vbNewLine & Trim(objAddr.Fields("State"))

Then I add this string in an Excel sheet and then do autofit :

objSheet.Columns.AutoFit


But, for some reason, it just does not autofit.

Autofit works fine as long as text is in single line, but multiline text as given above spoils all the autofit.

I tried turning word wrap on/off, but no use.

Is there any way to format multiline text in a single cell ?

Thanks and Regards,
Amol.  

ASKER CERTIFIED SOLUTION
Avatar of riduce
riduce

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ammox2000
ammox2000

ASKER

Thanks a lot for your quick response. It WORKED.

Amol.