|
-
Nov 17th, 2000, 11:29 AM
#1
Thread Starter
Hyperactive Member
I'm using outlook objects, creating a mail message with .CreateItem(olMailItem). I've tried assigning text to a string like this:
sBody = sBody & sNewString & vbNewLine
and like this:
sBody = sBody & sNewString & vbCrLf
But when I set the .Body property of the mail item =sBody, and .Send the message, the text body is one big string, no end of lines anywhere. ??
-
Nov 17th, 2000, 11:45 AM
#2
Fanatic Member
...
Don't have too much time to look into this...
but if u break it this way... it should work
.Body = .Body & " The string u want: " & vbNewLine
.Body = .Body & " Please remember to !" & vbNewLine
or if u insist not to do it like that...
I don't know.. try to turn sBody into a variant..
May be that will make a difference
-
Nov 17th, 2000, 11:47 AM
#3
Thread Starter
Hyperactive Member
Thanks, and I found my problem
I was writing the body to a text file then reading it. I think the vbNewLine char was lost in the translation. Thanks for your reply.
-
Nov 17th, 2000, 11:51 AM
#4
Fanatic Member
..Curious
Interesting...
How did u solve it?
-
Nov 17th, 2000, 05:55 PM
#5
Thread Starter
Hyperactive Member
solution..
I was writing to a text file:
Print #iFile, sMessageLine & vbNewLine
Then I was reading from the text file and concatenating a string:
Line Input #1, sMessageLine
sBody = sBody & sMessageLine
Then:
.Body = sBody
I moved the concat of vbNewLine from the Print # statement to the sBody = statment. Don't know alot about text files, maybe it couldn't be stored/retrieved properly.
Thanks for asking!
-
Nov 17th, 2000, 06:45 PM
#6
_______
<?>
'it can be done from a file like this.
Code:
Option Explicit
Private Sub Command1_Click()
Dim objOutlook As New Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
' Create new message
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
'file format is this just 3 lines for testing.
'my old line
'my new line
'my ending line
'open the file and read it
Dim mystring As String, myNewString As String
Open "c:\my documents\myfile.txt" For Input As #1
Do Until EOF(1)
Line Input #1, mystring
myNewString = myNewString & vbCrLf & mystring
Loop
Close #1
With objOutlookMsg
.To = "[email protected]"
.Subject = "Just A Dummy Old Test..."
.Body = myNewString
.Importance = olImportanceHigh
.Send
End With
Set objOutlookMsg = Nothing
' Close Outlook instance: Important!
Set objOutlook = Nothing
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|