Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default UDF Macro Looping Issue Erroring out

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default UDF Macro Looping Issue Erroring out

Anybody? I will even take some guesses at this point...

Tyson


On Jun 1, 2:16*pm, Tysone wrote:
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


Reply
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
Rows Group -looping issue Jen[_4_] Excel Programming 5 June 18th 07 08:42 PM
Do loop erroring [email protected] Excel Programming 9 May 31st 07 02:50 PM
VBA code erroring in XL97... sharpie23 Excel Programming 1 February 15th 06 07:26 PM
Looping issue davidm Excel Programming 3 August 8th 05 06:58 PM
Excel Erroring on Close Denny Behnfeldt Excel Programming 1 February 22nd 05 02:19 AM


All times are GMT +1. The time now is 06:51 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"