Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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
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
SQL-Query from a textfile? Stift[_30_] Excel Programming 5 June 10th 04 08:12 AM
Reading Textfile into a variable Seth[_3_] Excel Programming 1 April 11th 04 08:46 PM
Textfile-problem Tom Excel Programming 0 August 6th 03 05:01 PM
Opening and saving textfile into XLS MicMast Excel Programming 1 August 4th 03 01:33 PM
Excel VBA to access URL as Textfile Günter Kehrer Excel Programming 1 August 3rd 03 07:54 PM


All times are GMT +1. The time now is 03:05 AM.

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"