Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Create and write a simple text file in Excel/VBA

Hi,

what is the easiest way to create a new text file, write one string into
the file and close it afterwards?


Regards, Thomas
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Create and write a simple text file in Excel/VBA

Hi Thomas
have a look at the Write method in the VBA help (included an example
for this)

--
Regards
Frank Kabel
Frankfurt, Germany


Thomas Wieser wrote:
Hi,

what is the easiest way to create a new text file, write one string
into the file and close it afterwards?


Regards, Thomas


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default Create and write a simple text file in Excel/VBA

Dim F1 As Integer
F1 = FreeFile
Open "fullpathname\filename.txt" For Output As F1
Print #F1, "Test line" 'Prints: Test Line
Print #F1, yourvariable 'Prints: the value of your variable
Print #F1, "The vaue of yourvariable is: " & yourvariable 'Prints: the
concatation of "quoted" and yourvariable
Close #F1
F1 = 0



Thomas Wieser wrote:

Hi,

what is the easiest way to create a new text file, write one string into
the file and close it afterwards?


Regards, Thomas

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Create and write a simple text file in Excel/VBA

Hi Thomas,

From Help

FileNumber = FreeFile
Open "C:\My Documents\TEST10" For Output As #FileNumber
Write #FileNumber, "This is a sample."
Close #FileNumber

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Thomas Wieser" <wernze.nospam@gmx_net wrote in message
y.telekom.at...
Hi,

what is the easiest way to create a new text file, write one string into
the file and close it afterwards?


Regards, Thomas



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Create and write a simple text file in Excel/VBA

Hi to all,

thanks a lot!


Regards, Thomas
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
Can I use Excel to create this text file? BigIan Excel Worksheet Functions 4 September 15th 05 03:06 PM
how to write other language in text file from VBA Ravi Excel Programming 1 January 27th 04 03:21 AM
write 1-dimensional array of integers to text file RB Smissaert Excel Programming 3 October 12th 03 05:56 PM
opening and write to a text file in excel julian brotherton Excel Programming 1 October 5th 03 11:13 PM
write a line from Excel to a text file julian_bro Excel Programming 1 September 30th 03 01:29 AM


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