LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default Combining 2 Text Strings in Body of E-Mail Q

I am trying to create a string of text to place in the message body of
an e-mail. Using Ron De Bruins code I've run in to the "Too many line
continuations". I've a requirement for 31 lines, but it hits this
error on line 24. How can I combine 2 text strings to appear in the
message body of the reports. My code with only the first stringbody
is:-

Sub Mail_New_Version()
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim Sourcewb As Workbook
Dim Destwb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim OutApp As Object
Dim OutMail As Object
Dim sh As Worksheet

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set Sourcewb = ActiveWorkbook

ActiveWindow.TabRatio = 0.908

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

For Each cell In ThisWorkbook.Sheets("Report").Range("BJ1:BJ25")
strbody = strbody & cell.Value & vbNewLine
Next

strbody1 = ThisWorkbook.Sheets("Master").Range("E1").Value & _
ThisWorkbook.Sheets("Master").Range("E2").Value & _
ThisWorkbook.Sheets("Master").Range("E3").Value & _
ThisWorkbook.Sheets("Master").Range("E4").Value & _
ThisWorkbook.Sheets("Master").Range("E5").Value & _
ThisWorkbook.Sheets("Master").Range("E6").Value & " " &
ThisWorkbook.Sheets("Report").Range("B62").Value & _
ThisWorkbook.Sheets("Master").Range("E7").Value & " " &
ThisWorkbook.Sheets("Report").Range("B63").Value & _
ThisWorkbook.Sheets("Master").Range("E8").Value & " " &
ThisWorkbook.Sheets("Report").Range("B64").Value & _
ThisWorkbook.Sheets("Master").Range("E9").Value & _
ThisWorkbook.Sheets("Master").Range("E10").Value & _
ThisWorkbook.Sheets("Master").Range("E11").Value & " " &
ThisWorkbook.Sheets("Report").Range("B33").Value & _
ThisWorkbook.Sheets("Master").Range("E12").Value & " " &
ThisWorkbook.Sheets("Report").Range("B34").Value & _
ThisWorkbook.Sheets("Master").Range("E13").Value & " " &
ThisWorkbook.Sheets("Report").Range("B35").Value & _
ThisWorkbook.Sheets("Master").Range("E14").Value & _
ThisWorkbook.Sheets("Master").Range("E15").Value & _
ThisWorkbook.Sheets("Master").Range("E16").Value & " " &
ThisWorkbook.Sheets("Report").Range("B56").Value & _
ThisWorkbook.Sheets("Master").Range("E17").Value & " " &
ThisWorkbook.Sheets("Report").Range("B57").Value & _
ThisWorkbook.Sheets("Master").Range("E18").Value & " " &
ThisWorkbook.Sheets("Report").Range("B58").Value & _
ThisWorkbook.Sheets("Master").Range("E19").Value & _
ThisWorkbook.Sheets("Master").Range("E20").Value & _
ThisWorkbook.Sheets("Master").Range("E21").Value & " " &
ThisWorkbook.Sheets("Report").Range("B49").Value & _
ThisWorkbook.Sheets("Master").Range("E22").Value & " " &
ThisWorkbook.Sheets("Report").Range("B50").Value & _
ThisWorkbook.Sheets("Master").Range("E23").Value & " " &
ThisWorkbook.Sheets("Report").Range("B51").Value & _
ThisWorkbook.Sheets("Master").Range("E24").Value & " " &
ThisWorkbook.Sheets("Report").Range("B52").Value



With Destwb
On Error Resume Next
With OutMail
.To = ThisWorkbook.Sheets("Master").Range("B1").Value
.CC = ""
.BCC = ""
.Subject = ThisWorkbook.Sheets("Report").Range("B2").Value
.Body = strbody
.ReadReceiptRequested = False
.Importance = 1
.Send
Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys "%S"
End With
On Error GoTo 0
.Close SaveChanges:=False
End With

Set OutMail = Nothing
Set OutApp = Nothing

With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub
 
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
Combining Text Strings - Complex ksawyers Excel Worksheet Functions 1 August 9th 05 08:11 PM
Combining text strings Hayley Excel Worksheet Functions 6 May 5th 05 12:46 AM
Excel 2003 / Send To / Mail Recipient / body text is removed jmaynard2 Excel Discussion (Misc queries) 1 March 16th 05 02:26 AM
Adding text to the body of an e-mail Greg Maloney Excel Programming 1 June 28th 04 05:01 PM
Sending Mail from Excel: Body Text Kathryn Excel Programming 3 December 1st 03 07:56 PM


All times are GMT +1. The time now is 11:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"