This is from the Ron De Bruin HTML to range code for emailing.
In this code, what does the Paste:=8 do or mean? If removed from the code or changed paste returns blank, if left there only a partial paste of the HTML returns into the e-mail. I have to add a + 16 to paste entire table and it drives me crazy. In trying to trace I run across this piece of code and i do not understand how it works or what it does.
'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
I am using below to define the range, but if I do not add plus some number ( + 16 rows, or whatever number to extend the range) it only posts a partial range and not the entire range in the email I am sending.
count_Row = WorksheetFunction.CountA(Range("A16", Range("A16").End(xlDown)))
count_Col = WorksheetFunction.CountA(Range("A16", Range("A16").End(xlToRight)))
code:
Sub email_Range()
Dim OutApp As Object
Dim OutMail As Object
Dim count_Row As Integer
Dim count_Col As Integer
Dim pop As Range
Dim popper As Range
Dim str1 As String
Dim str2 As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Sheets("Starts").Select
Range("A16").Select
count_Row = WorksheetFunction.CountA(Range("A16", Range("A16").End(xlDown)))
count_Col = WorksheetFunction.CountA(Range("A16", Range("A16").End(xlToRight)))
Set pop = Sheets("Starts").Range(Cells(16, 1), Cells(count_Row, count_Col))
Set popper = Sheets("Starts").Range(Cells(1, 6), Cells(6, 19))
str1 = "<BODY style = font-family:Verdana;font-size:12pt>" & "Good Morning Team! <br><br> Allocated Alignments for week " & Range("A1") & " are " & Range("B1") & _
" and we have loaded WTD " & Range("C1") & " Alignments" & "<br><br>"
str2 = "<BODY style = font-family:Verdana;font-size:12pt>" & _
"Here is the current starts queue as of this morning's system update, minus items on CREDIT HOLD, that cannot be started. <br><br>"
On Error Resume Next
With OutMail
.To = "" & ";" & ""
.CC = ""
.BCC =
.Subject = "Week " & Range("A1") & " - " & " Starts Queue as of Today " & Range("D1") & " - (after current week loaded) "
.HTMLBody = str1 & str2 & RangetoHTML(popper) & RangetoHTML(pop) & .HTMLBody
.Display
' .Attachments.Add
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Range("A16").Select
In this code, what does the Paste:=8 do or mean? If removed from the code or changed paste returns blank, if left there only a partial paste of the HTML returns into the e-mail. I have to add a + 16 to paste entire table and it drives me crazy. In trying to trace I run across this piece of code and i do not understand how it works or what it does.
'Copy the range and create a new workbook to past the data in
rng.Copy
Set TempWB = Workbooks.Add(1)
With TempWB.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
I am using below to define the range, but if I do not add plus some number ( + 16 rows, or whatever number to extend the range) it only posts a partial range and not the entire range in the email I am sending.
count_Row = WorksheetFunction.CountA(Range("A16", Range("A16").End(xlDown)))
count_Col = WorksheetFunction.CountA(Range("A16", Range("A16").End(xlToRight)))
code:
Sub email_Range()
Dim OutApp As Object
Dim OutMail As Object
Dim count_Row As Integer
Dim count_Col As Integer
Dim pop As Range
Dim popper As Range
Dim str1 As String
Dim str2 As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Sheets("Starts").Select
Range("A16").Select
count_Row = WorksheetFunction.CountA(Range("A16", Range("A16").End(xlDown)))
count_Col = WorksheetFunction.CountA(Range("A16", Range("A16").End(xlToRight)))
Set pop = Sheets("Starts").Range(Cells(16, 1), Cells(count_Row, count_Col))
Set popper = Sheets("Starts").Range(Cells(1, 6), Cells(6, 19))
str1 = "<BODY style = font-family:Verdana;font-size:12pt>" & "Good Morning Team! <br><br> Allocated Alignments for week " & Range("A1") & " are " & Range("B1") & _
" and we have loaded WTD " & Range("C1") & " Alignments" & "<br><br>"
str2 = "<BODY style = font-family:Verdana;font-size:12pt>" & _
"Here is the current starts queue as of this morning's system update, minus items on CREDIT HOLD, that cannot be started. <br><br>"
On Error Resume Next
With OutMail
.To = "" & ";" & ""
.CC = ""
.BCC =
.Subject = "Week " & Range("A1") & " - " & " Starts Queue as of Today " & Range("D1") & " - (after current week loaded) "
.HTMLBody = str1 & str2 & RangetoHTML(popper) & RangetoHTML(pop) & .HTMLBody
.Display
' .Attachments.Add
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Range("A16").Select