Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Writing a line in to a file

Hi

I am writing a line (text) from file 1 to file 2. I am reading a line from
file 1 and writing in to file 2 using the below code. The line in file 1 is
appended with double quotes (") and then written in to file 2. Can anybody
suggest me a way to avoide this double quotes.

For Ex:
If file 1 has the sentance - This is line in file 1
then file 2 will be - "This is line in file 1"

Thanks in advance
Sridhar P


Code
-------

Sub SplitFile()

Dim InputData

Open "C:\inpfile.txt" For Input As #1

Open "C:\outfile.txt" For Output As #2

Line Input #1, InputData

Write #2, InputData

Close #2

Close #1

End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Writing a line in to a file

Change
Write #2, InputData

to
Print #2, InputData

--
Regards,
Tom Ogilvy

"Sridhar P via OfficeKB.com" <u2751@uwe wrote in message
news:5612d34d9a8a4@uwe...
Hi

I am writing a line (text) from file 1 to file 2. I am reading a line from
file 1 and writing in to file 2 using the below code. The line in file 1

is
appended with double quotes (") and then written in to file 2. Can anybody
suggest me a way to avoide this double quotes.

For Ex:
If file 1 has the sentance - This is line in file 1
then file 2 will be - "This is line in file 1"

Thanks in advance
Sridhar P


Code
-------

Sub SplitFile()

Dim InputData

Open "C:\inpfile.txt" For Input As #1

Open "C:\outfile.txt" For Output As #2

Line Input #1, InputData

Write #2, InputData

Close #2

Close #1

End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Writing a line in to a file

Write # delimits the output with "" and commas; use Print# instead to send
the data to the file exactly as you have specified it in your code.
--
- K Dales


"Sridhar P via OfficeKB.com" wrote:

Hi

I am writing a line (text) from file 1 to file 2. I am reading a line from
file 1 and writing in to file 2 using the below code. The line in file 1 is
appended with double quotes (") and then written in to file 2. Can anybody
suggest me a way to avoide this double quotes.

For Ex:
If file 1 has the sentance - This is line in file 1
then file 2 will be - "This is line in file 1"

Thanks in advance
Sridhar P


Code
-------

Sub SplitFile()

Dim InputData

Open "C:\inpfile.txt" For Input As #1

Open "C:\outfile.txt" For Output As #2

Line Input #1, InputData

Write #2, InputData

Close #2

Close #1

End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Writing a line in to a file

Hi Friends,

Thanks for the solution.... It serves my purpose...

Thanks
Sridhar P


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200510/1
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 create a line break writing text within a cell? Shel Excel Discussion (Misc queries) 1 December 11th 08 12:19 AM
Write Line problem when writing simplified chinese characters KI LEE Excel Programming 7 August 17th 05 05:41 AM
Writing a CSV file guy Excel Programming 2 January 21st 05 09:57 AM
Writing a .txt file Claus[_2_] Excel Programming 2 September 27th 04 01:47 AM
file writing Mike[_49_] Excel Programming 0 November 22nd 03 06:57 PM


All times are GMT +1. The time now is 01:29 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"