Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default truncate text using VBA Excel


Hi,

I've got a progam running in CL (AS400) that exports a file into a cs
file. This file contains names of other files that I wish to open. Th
problem being these fiels have a fixed length of 10 and are filled wit
blanks if the text is not long enough to fill the 10 characters.

This cause a problem when joining field with ".csv".

Eg "EEC1 " & ".csv" I get "EEC1 .csv", and I want
"EEC1.csv"

Is there a way to do this.

Thanks

Eve Emer

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default truncate text using VBA Excel

You can use the Trim function

Sub test()
For Each cell In Columns("A").SpecialCells(xlCellTypeConstants)
cell.Value = Trim(cell.Value)
Next
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"maehe" wrote in message ...

Hi,

I've got a progam running in CL (AS400) that exports a file into a csv
file. This file contains names of other files that I wish to open. The
problem being these fiels have a fixed length of 10 and are filled with
blanks if the text is not long enough to fill the 10 characters.

This cause a problem when joining field with ".csv".

Eg "EEC1 " & ".csv" I get "EEC1 .csv", and I want
"EEC1.csv"

Is there a way to do this.

Thanks

Eve Emery


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default truncate text using VBA Excel


Thank You very much!

It's all implemented fine! Thank you again

:

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I truncate linked text? Jenni Excel Worksheet Functions 1 April 9th 10 07:10 PM
formula to truncate text characters MarkT Excel Discussion (Misc queries) 6 June 4th 09 04:19 PM
truncate text to first word Harry C Excel Discussion (Misc queries) 5 July 3rd 08 05:14 AM
How do I truncate a text field in Excel? Baxter Excel Worksheet Functions 3 September 27th 07 12:23 AM
How do you truncate a text string? dailygluttony Excel Worksheet Functions 2 March 28th 06 08:08 PM


All times are GMT +1. The time now is 10:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"