PDA

View Full Version : Solved: Export to Text File



gnod
01-23-2007, 09:53 AM
Hi,

how can i export the worksheet (Sheet1) to text file using the restriction/rules in "Txt Layout" sheet.. In column G, this is the corresponding column in Sheet1.. some data is constant in the text file.. pls refer to the attach file.. if the data in the worksheet exceed the field length, it will only get the number of digits/characters provided in that field (for example, if the field length is 35 characters, only 35 characters will be shown and others will be drop)..


Thanks..

lucas
01-23-2007, 11:08 AM
I don't think you can do that kind of formatting in a text file.....maybe I misunderstand the problem.

gnod
01-24-2007, 09:20 AM
isn't possible :(
all i want is to put the data coming from excel to text file in their proper position, for example the voucher number will start on the 11th character position and should be 10 digits only.. :help

lucas
01-24-2007, 09:37 AM
Hi,

how can i export the worksheet (Sheet1) to text file using the restriction/rules in "Txt Layout" sheet.. In column G

Sorry, I misunderstood your request based on this sentence.

Charlize
01-25-2007, 02:50 AM
For the voucher number use mid function to determine number of positions to export (start, lenght of characters to export) if > 11

--- why not using a delimiter ? when voucher is less than 11, do you have to add a certain number of spaces or zeros to get 11 characters ? ---

Charlize

gnod
01-25-2007, 09:08 AM
For the voucher number use mid function to determine number of positions to export (start, lenght of characters to export) if > 11

--- why not using a delimiter ? when voucher is less than 11, do you have to add a certain number of spaces or zeros to get 11 characters ? ---
Charlize

the txt layout sheet if the format of the text file.. voucher number is 10 digits only. if it is less than 10 then it must be padded with zeroes (refer to the txt layout sheet)..

if you run the sub procedure "ExportToTextFile", it already created the text file but the problem is i must comply with the position format in the text file..

gnod
01-29-2007, 08:24 AM
does anyone know how to do this..
Thanks..

Charlize
01-30-2007, 12:46 PM
Have you tried this kb article : http://vbaexpress.com/kb/getarticle.php?kb_id=759

Charlize

gnod
01-31-2007, 08:24 AM
Charlize,

thanks.. this is the one i'm looking for.. :yes