Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 8th, 2008, 11:56 PM
Authorized User
Join Date: Aug 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to continue to wite to a text file

Hi All !

I want to write some text line to a existing text-file. When I use input# function old information is deleted.

Many Thanks.

Old March 9th, 2008, 08:51 PM
Friend of Wrox
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts


You can try opening the file using append

Open "c:\Windows\Temp\Sample.txt" For Append As 1

           Print #1 , "My Text"

Close #1

also you can try File System Object also

Sub Append_Text_Files()

Dim oFS As FileSystemObject

Dim oTS As TextStream

Dim vTemp

Set oFS = New FileSystemObject

For i1 = 1 To 30

Set oTS1 = oFS.OpenTextFile("c:\CombinedTemp.txt", ForAppending, True)
oTS1.Write (i1)

Next i1

End Sub




VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Old March 10th, 2008, 05:03 PM
Authorized User
Join Date: Aug 2007
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Shasur
Great! Thanks alot.

Best whishes.

Similar Threads
Thread Thread Starter Forum Replies Last Post
continue dayang Classic ASP Basics 1 April 29th, 2008 11:22 PM
How to continue to next new excel worksheet christine_wmw Classic ASP Basics 0 January 24th, 2007 02:54 AM
continue topic: form lock down problem flyfish Access 6 March 30th, 2005 11:31 AM
break & continue problem. gredata C# 1 December 21st, 2004 05:38 AM
Extract text from text file & put in dropdown box tsukey Beginning PHP 5 July 20th, 2004 09:49 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.