What does this code do or mean

Perrister

Board Regular
Joined
Nov 30, 2004
Messages
93
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
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,224,811
Messages
6,181,080
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top