A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

last string in txt file



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 9th 06, 06:37 AM posted to microsoft.public.outlook.program_vba
Leech
external usenet poster
 
Posts: 3
Default last string in txt file

Hi there!

Need Yr help.
I have a simple txt file and need to add "//" (these two symbols) to the end
of the file (last string). Hv tried different ways but always hv carrier
return code between last text string and "//".
example:
text: BLA BLA BLA -need this BLA BLA BLA//

but always get:
BLA BLA BLA
//

thanks!

exmaple code:
dim nf as integer

nf = freefile

open lpfilename for binary access write as nf
put nf, LOF(nf), "=="
close nf
Ads
  #2  
Old February 10th 06, 07:13 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default last string in txt file

Am Wed, 8 Feb 2006 22:37:26 -0800 schrieb Leech:

Try this please:

Public Sub WriteFile(sPath As String, _
sText As String, _
Optional ByVal bAppend As Boolean _
)
On Error GoTo AUSGANG
Dim lFileNr As Long

lFileNr = FreeFile

Select Case bAppend
Case False
Open sPath For Output As #lFileNr
Case Else
Open sPath For Append As #lFileNr
End Select

Print #lFileNr, sText;

AUSGANG:
If lFileNr Then
Close #lFileNr
End If

If Err.Number Then Err.Raise &H800A0000 Or Err.Number, _
Err.Source, Err.Description, Err.HelpFile, Err.HelpContext
End Sub


--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi there!

Need Yr help.
I have a simple txt file and need to add "//" (these two symbols) to the

end
of the file (last string). Hv tried different ways but always hv carrier
return code between last text string and "//".
example:
text: BLA BLA BLA -need this BLA BLA BLA//

but always get:
BLA BLA BLA
//

thanks!

exmaple code:
dim nf as integer

nf = freefile

open lpfilename for binary access write as nf
put nf, LOF(nf), "=="
close nf

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need String from Email Subject CondtllyFrmttd Outlook and VBA 1 January 25th 06 04:26 PM
Use Part of Subject as String CondtllyFrmttd Outlook - General Queries 0 January 23rd 06 06:57 PM
string variable that contains formatting Martin Outlook and VBA 4 January 19th 06 09:49 AM
Problem with saving .txt attachement norhaya Outlook and VBA 4 January 12th 06 09:20 AM
Problem with saving .txt attachement Michael Bauer Outlook and VBA 3 January 11th 06 08:22 AM


All times are GMT +1. The time now is 10:28 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.