UDF Macro Looping Issue Erroring out

T

Tysone

I'm having a little issue with my macro and I think my UDF is the
problem.

Big picture is that my macro loops though my work email list, adds
attachments and a body just fine for my first name, but it catches
when it goes to name two. Can someone help me fix my code?

Thanks for your time,

Tyson



Function Get_Body() As String
Dim ie As Object, nav As String
Dim Cell As Range
Dim I As Long

Start = frmPrintFile.txtFirst.Text + 1
Finish = frmPrintFile.txtLast.Text + 1
For Each Cell In Range("A" & Start & ":A" & Finish).Cells

nav = Cell.Offset(0, 3).Value
Set ie = CreateObject("InternetExplorer.Application")
With ie
ie.Visible = False
ie.navigate nav
Do Until .ReadyState = 4
Loop
Get_Body = .Document.body.InnerHTML
.Quit

End With
Next
Set ie = Nothing
End Function

Function Get_Body2() As String
Dim ie As Object, nav2 As String
Dim Cell As Range
Dim I As Long

Start = frmPrintFile.txtFirst.Text + 1
Finish = frmPrintFile.txtLast.Text + 1
For Each Cell In Range("A" & Start & ":A" & Finish).Cells

nav2 = Cell.Offset(0, 4).Value
Set ie = CreateObject("InternetExplorer.Application")
With ie
ie.Visible = False
ie.navigate nav2
'.navigate "C:\Documents and Settings\tedwards\test
attachment.htm"
Do Until .ReadyState = 4
Loop
Get_Body2 = .Document.body.InnerHTML
.Quit

End With
Next
Set ie = Nothing
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top