macro load webpage copy it and paste in e-mail body

CrashOD

Board Regular
Joined
Feb 5, 2019
Messages
118
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
'Declare Variables
Dim EmailApp As Object
Dim EmailItem As Object
Dim myAttachments As Object
Dim mailAddress As String
Dim TaxCertPDF As String
Dim NorryLink As String
' Dim EMail As String
'Set Variables
Set EmailApp = CreateObject("Outlook.application")
Set EmailItem = EmailApp.CreateItem(0)
Set myAttachments = EmailItem.Attachments

' E-Mail Subject Parcel - Requestor - Date.pdf
TaxCertPDF = "T:\2022_TAX_CERTS\" & Sheets("Tax Cert Bill").Range("B17").Value & " - " & Sheets("Tax Cert Bill").Range("B12").Value & Format(Date, " - mm-dd-yyyy") & ".pdf"

NorryLink = "https://tax.norrycopa.net/taxclaim/trirsp2pp.asp?parcel=" & Sheets("Tax Cert Bill").Range("B17").Value

Dim FinalResult As Variant, Table_Range As Range, LookupValue As Range

Set Table_Range = Sheets("Requestor").Range("A:B")
Set LookupValue = Sheets("Tax Cert Bill").Range("B12")
FinalResult = Application.WorksheetFunction.VLookup(LookupValue, Table_Range, 2, False)


Dim html As MSHTML.HTMLDocument
dim hTable As Object
dim NorryLink As Hyperlink


Set html = New MSHTML.HTMLDocument

With CreateObject("MSXML2.XMLHTTP")
.Open "GET", NorryLink, False
.send
.html.body.innerHTML = .responseText
End With




' Set html = New MSHTML.HTMLDocument
' With CreateObject("MSXML2.XMLHTTP")
' Home - County of Northumberland
' .Open "GET", NorryLink, False
' .send
' html.body.innerHTML = .responseText
'End With


'Specify Email Items and Add Attachment
With EmailItem
.To = FinalResult
.Subject = Sheets("Tax Cert Bill").Range("B17").Value
.body = "Please find the PDF attachment"
.Attachments.Add TaxCertPDF
'.send
.Display
End With
Set EmailItem = Nothing
Set EmailApp = Nothing










as you can see i tried to work with different codes all give me error at .html.body.innerHTML = .responseText. why lots of ' but it has helped for all the other stuff i have been doing in this macro.
link to use Home - County of Northumberland

I'm trying to have it copy that page and add it to the body of the e-mail. i can not install stuff on this computer. but other then getting to copy page and put in e-mail i get it to other wise do as i need.

any help is greatly appreciated.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Sub IE_Load_PrintScreen()

' IE and OutLook
Dim NorryLink As String

' Link to copy Print Screen
NorryLink = "Home - County of Northumberland" & Sheets("Tax Cert Bill").Range("B17").Value

Dim IE As Object
Dim hwnd As Long, IECaption As String

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Width = 624
IE.Height = 756

IE.Navigate NorryLink

Wait 10
DoEvents

' ~~> Take a snapshot
Call keybd_event(VK_SNAPSHOT, 1, 0, 0)

'Application.SendKeys "(%{1068})"
DoEvents


IE.Quit
Set IE = Nothing

End Sub

fixed it! thanks all who looked at post
 
Upvote 0
Solution

Forum statistics

Threads
1,215,398
Messages
6,124,688
Members
449,179
Latest member
kfhw720

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