How do i save as a textfile in a macro?
Hi
I have problems saving my text file in the right format? I am working on a macro that opens a text file, changes a value to a value found in another workbook, and saving the changed textfile with a new name. The lines in the text files contains both text and numbers, and are seperated by commas. The text file is opened with no delimiters and some of the lines are changed. The changing and renaming part works fine, but excel adds a " at each end of every line in the new text file when the macro saves the file. This doesn't happen when I save the file manually... Does anyone know how to avoid getting the " when the macro saves the file? Greetings Alex |
How do i save as a textfile in a macro?
What process are you using to open, write to, and save your text file? I
think I was using FreeFile and Write and it threw in quotes all over the place. That's just the way that works. If that's what you're doing, check out Write # in the VBA Help. Ed "Alex_DK" wrote in message ... Hi I have problems saving my text file in the right format? I am working on a macro that opens a text file, changes a value to a value found in another workbook, and saving the changed textfile with a new name. The lines in the text files contains both text and numbers, and are seperated by commas. The text file is opened with no delimiters and some of the lines are changed. The changing and renaming part works fine, but excel adds a " at each end of every line in the new text file when the macro saves the file. This doesn't happen when I save the file manually... Does anyone know how to avoid getting the " when the macro saves the file? Greetings Alex |
How do i save as a textfile in a macro?
Alex,
If you have found the solution, could yu tell me how you automatically save your excel file as a textfile in a macro ? Thanks in advance Serge "Alex_DK" wrote: Hi I have problems saving my text file in the right format? I am working on a macro that opens a text file, changes a value to a value found in another workbook, and saving the changed textfile with a new name. The lines in the text files contains both text and numbers, and are seperated by commas. The text file is opened with no delimiters and some of the lines are changed. The changing and renaming part works fine, but excel adds a " at each end of every line in the new text file when the macro saves the file. This doesn't happen when I save the file manually... Does anyone know how to avoid getting the " when the macro saves the file? Greetings Alex |
How do i save as a textfile in a macro?
You could write your own macro.
Here are three sites that you could steal some code from: Earl Kiosterud's Text Write program: www.smokeylake.com/excel (or directly: http://www.smokeylake.com/excel/text_write_program.htm) Chip Pearson's: http://www.cpearson.com/excel/imptext.htm J.E. McGimpsey's: http://www.mcgimpsey.com/excel/textfiles.html If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm Alex_DK wrote: Hi I have problems saving my text file in the right format? I am working on a macro that opens a text file, changes a value to a value found in another workbook, and saving the changed textfile with a new name. The lines in the text files contains both text and numbers, and are seperated by commas. The text file is opened with no delimiters and some of the lines are changed. The changing and renaming part works fine, but excel adds a " at each end of every line in the new text file when the macro saves the file. This doesn't happen when I save the file manually... Does anyone know how to avoid getting the " when the macro saves the file? Greetings Alex -- Dave Peterson |
All times are GMT +1. The time now is 08:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com