PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Error printing html file using IE object model in outlook

Reply

Error printing html file using IE object model in outlook

 
Thread Tools Rate Thread
Old 03-05-2004, 09:22 PM   #1
Osama Yahya
Guest
 
Posts: n/a
Default Error printing html file using IE object model in outlook


Hi there:
I have a macro in outlook that prints html attachment
using IE object model and I am getting ExecWB failed error
when I runs the macro, here is my code, any help is
appreciated.

On Error GoTo GetAttachments_err
Dim Inbox As MAPIFolder
Dim EZBUYSubInbox As MAPIFolder '**
Dim JunkSubInbox As MAPIFolder '**
Dim email As MailItem
Dim Atmt As Attachment
Dim i As Integer, Count As Integer
Const FileName = "C:\ATT\"
Set Inbox = GetNamespace("MAPI").GetDefaultFolder
(olFolderInbox)
Set EZBUYSubInbox = Inbox.Folders("EZBUY")
Set JunkSubInbox = Inbox.Folders("Junk")

Dim IE As New InternetExplorer

i = 0
If Inbox.Items.Count = 0 Then Exit Sub
'cycle through emails
For Each email In Inbox.Items
If email.UnRead Then '**

If email.Subject = "PCO" Then

If email.Attachments.Count > 0 Then
For Count = email.Attachments.Count To 1 Step -1
Set Atmt = email.Attachments.Item(Count)
'If LCase(Right(Atmt.FileName, 3)) = "wav" Or _
' LCase(Right(Atmt.FileName, 3)) = "xml" Then
Atmt.SaveAsFile (FileName & Atmt.FileName)


IE.Visible = False
IE.navigate FileName & Atmt.FileName

While IE.readyState = 4
DoEvents
Wend

Do Until IE.Busy <> False
DoEvents
Loop

IE.ExecWB 6, 2, 0, 0


If Not EZBUYSubInbox Is Nothing Then
' email.Move EZBUYSubInbox
End If

'Atmt.Delete
i = i + 1
'End If
Next Count
' email.Save
End If

Else
email.Move JunkSubInbox

End If
End If '**
Next email
If i > 0 Then
'MsgBox " " & i & " attached files were found." _
' & vbCrLf & "They have been copied to your work
folder." _
' & vbCrLf & vbCrLf & "Have a nice day.",
vbInformation, "Finished!"
End If
GetAttachments_exit:
Set Atmt = Nothing
Set email = Nothing
Set Inbox = Nothing
Set EZBUYSubInbox = Nothing
Set JunkSubInbox = Nothing
Set IE = Nothing
Exit Sub
GetAttachments_err:
MsgBox "An unexpected error has occurred." _
& vbCrLf & "Please note and report the following
information." _
& vbCrLf & "Macro Name: GetAttachments" _
& vbCrLf & "Error Number: " & Err.Number _
& vbCrLf & "Error Description: " & Err.Description _
, vbCritical, "Error!"
Resume GetAttachments_exit
  Reply With Quote
Old 03-05-2004, 10:33 PM   #2
Eric Legault [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Error printing html file using IE object model in outlook

The only problem I see is your declaration of the email variable. Change
that to Dim email As Object. If there are any non-email messages in that
folder, an error will be generated because the items are of a different
class.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/


"Osama Yahya" <osamay@lasernetworks.com> wrote in message
news:7c7001c4314c$63de8720$a301280a@phx.gbl...
> Hi there:
> I have a macro in outlook that prints html attachment
> using IE object model and I am getting ExecWB failed error
> when I runs the macro, here is my code, any help is
> appreciated.
>
> On Error GoTo GetAttachments_err
> Dim Inbox As MAPIFolder
> Dim EZBUYSubInbox As MAPIFolder '**
> Dim JunkSubInbox As MAPIFolder '**
> Dim email As MailItem
> Dim Atmt As Attachment
> Dim i As Integer, Count As Integer
> Const FileName = "C:\ATT\"
> Set Inbox = GetNamespace("MAPI").GetDefaultFolder
> (olFolderInbox)
> Set EZBUYSubInbox = Inbox.Folders("EZBUY")
> Set JunkSubInbox = Inbox.Folders("Junk")
>
> Dim IE As New InternetExplorer
>
> i = 0
> If Inbox.Items.Count = 0 Then Exit Sub
> 'cycle through emails
> For Each email In Inbox.Items
> If email.UnRead Then '**
>
> If email.Subject = "PCO" Then
>
> If email.Attachments.Count > 0 Then
> For Count = email.Attachments.Count To 1 Step -1
> Set Atmt = email.Attachments.Item(Count)
> 'If LCase(Right(Atmt.FileName, 3)) = "wav" Or _
> ' LCase(Right(Atmt.FileName, 3)) = "xml" Then
> Atmt.SaveAsFile (FileName & Atmt.FileName)
>
>
> IE.Visible = False
> IE.navigate FileName & Atmt.FileName
>
> While IE.readyState = 4
> DoEvents
> Wend
>
> Do Until IE.Busy <> False
> DoEvents
> Loop
>
> IE.ExecWB 6, 2, 0, 0
>
>
> If Not EZBUYSubInbox Is Nothing Then
> ' email.Move EZBUYSubInbox
> End If
>
> 'Atmt.Delete
> i = i + 1
> 'End If
> Next Count
> ' email.Save
> End If
>
> Else
> email.Move JunkSubInbox
>
> End If
> End If '**
> Next email
> If i > 0 Then
> 'MsgBox " " & i & " attached files were found." _
> ' & vbCrLf & "They have been copied to your work
> folder." _
> ' & vbCrLf & vbCrLf & "Have a nice day.",
> vbInformation, "Finished!"
> End If
> GetAttachments_exit:
> Set Atmt = Nothing
> Set email = Nothing
> Set Inbox = Nothing
> Set EZBUYSubInbox = Nothing
> Set JunkSubInbox = Nothing
> Set IE = Nothing
> Exit Sub
> GetAttachments_err:
> MsgBox "An unexpected error has occurred." _
> & vbCrLf & "Please note and report the following
> information." _
> & vbCrLf & "Macro Name: GetAttachments" _
> & vbCrLf & "Error Number: " & Err.Number _
> & vbCrLf & "Error Description: " & Err.Description _
> , vbCritical, "Error!"
> Resume GetAttachments_exit



  Reply With Quote
Old 04-05-2004, 01:44 PM   #3
Osama Yahya
Guest
 
Posts: n/a
Default Re: Error printing html file using IE object model in outlook

Hi Eric:
Thanks for your reply, I will try to change the email to
object instead of MailItem....but before I make the
changes I just wanted to mention that When I run the macro
in debuggung mode it works fine, I am having the error
only when I run normaly.
>-----Original Message-----
>The only problem I see is your declaration of the email

variable. Change
>that to Dim email As Object. If there are any non-email

messages in that
>folder, an error will be generated because the items are

of a different
>class.
>
>--
>Eric Legault - B.A, MCP, MCSD, Outlook MVP
>--------------------------------------------------
>Job: http://www.imaginets.com
>Blog: http://blogs.officezealot.com/legault/
>
>
>"Osama Yahya" <osamay@lasernetworks.com> wrote in message
>news:7c7001c4314c$63de8720$a301280a@phx.gbl...
>> Hi there:
>> I have a macro in outlook that prints html attachment
>> using IE object model and I am getting ExecWB failed

error
>> when I runs the macro, here is my code, any help is
>> appreciated.
>>
>> On Error GoTo GetAttachments_err
>> Dim Inbox As MAPIFolder
>> Dim EZBUYSubInbox As MAPIFolder '**
>> Dim JunkSubInbox As MAPIFolder '**
>> Dim email As MailItem
>> Dim Atmt As Attachment
>> Dim i As Integer, Count As Integer
>> Const FileName = "C:\ATT\"
>> Set Inbox = GetNamespace("MAPI").GetDefaultFolder
>> (olFolderInbox)
>> Set EZBUYSubInbox = Inbox.Folders("EZBUY")
>> Set JunkSubInbox = Inbox.Folders("Junk")
>>
>> Dim IE As New InternetExplorer
>>
>> i = 0
>> If Inbox.Items.Count = 0 Then Exit Sub
>> 'cycle through emails
>> For Each email In Inbox.Items
>> If email.UnRead Then '**
>>
>> If email.Subject = "PCO" Then
>>
>> If email.Attachments.Count > 0 Then
>> For Count = email.Attachments.Count To 1 Step -1
>> Set Atmt = email.Attachments.Item(Count)
>> 'If LCase(Right(Atmt.FileName, 3)) = "wav" Or _
>> ' LCase(Right(Atmt.FileName, 3)) = "xml"

Then
>> Atmt.SaveAsFile (FileName & Atmt.FileName)
>>
>>
>> IE.Visible = False
>> IE.navigate FileName & Atmt.FileName
>>
>> While IE.readyState = 4
>> DoEvents
>> Wend
>>
>> Do Until IE.Busy <> False
>> DoEvents
>> Loop
>>
>> IE.ExecWB 6, 2, 0, 0
>>
>>
>> If Not EZBUYSubInbox Is Nothing Then
>> ' email.Move EZBUYSubInbox
>> End If
>>
>> 'Atmt.Delete
>> i = i + 1
>> 'End If
>> Next Count
>> ' email.Save
>> End If
>>
>> Else
>> email.Move JunkSubInbox
>>
>> End If
>> End If '**
>> Next email
>> If i > 0 Then
>> 'MsgBox " " & i & " attached files were found." _
>> ' & vbCrLf & "They have been copied to your work
>> folder." _
>> ' & vbCrLf & vbCrLf & "Have a nice day.",
>> vbInformation, "Finished!"
>> End If
>> GetAttachments_exit:
>> Set Atmt = Nothing
>> Set email = Nothing
>> Set Inbox = Nothing
>> Set EZBUYSubInbox = Nothing
>> Set JunkSubInbox = Nothing
>> Set IE = Nothing
>> Exit Sub
>> GetAttachments_err:
>> MsgBox "An unexpected error has occurred." _
>> & vbCrLf & "Please note and report the following
>> information." _
>> & vbCrLf & "Macro Name: GetAttachments" _
>> & vbCrLf & "Error Number: " & Err.Number _
>> & vbCrLf & "Error Description: " & Err.Description

_
>> , vbCritical, "Error!"
>> Resume GetAttachments_exit

>
>
>.
>

  Reply With Quote
Old 05-05-2004, 05:21 PM   #4
Eric Legault [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Error printing html file using IE object model in outlook

Are you saying that when you step through the code, it never reaches
GetAttachments_err? If so, that IS weird.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/


"Osama Yahya" <osamay@lasernetworks.com> wrote in message
news:812701c431d5$99736c50$a101280a@phx.gbl...
> Hi Eric:
> Thanks for your reply, I will try to change the email to
> object instead of MailItem....but before I make the
> changes I just wanted to mention that When I run the macro
> in debuggung mode it works fine, I am having the error
> only when I run normaly.
> >-----Original Message-----
> >The only problem I see is your declaration of the email

> variable. Change
> >that to Dim email As Object. If there are any non-email

> messages in that
> >folder, an error will be generated because the items are

> of a different
> >class.
> >
> >--
> >Eric Legault - B.A, MCP, MCSD, Outlook MVP
> >--------------------------------------------------
> >Job: http://www.imaginets.com
> >Blog: http://blogs.officezealot.com/legault/
> >
> >
> >"Osama Yahya" <osamay@lasernetworks.com> wrote in message
> >news:7c7001c4314c$63de8720$a301280a@phx.gbl...
> >> Hi there:
> >> I have a macro in outlook that prints html attachment
> >> using IE object model and I am getting ExecWB failed

> error
> >> when I runs the macro, here is my code, any help is
> >> appreciated.
> >>
> >> On Error GoTo GetAttachments_err
> >> Dim Inbox As MAPIFolder
> >> Dim EZBUYSubInbox As MAPIFolder '**
> >> Dim JunkSubInbox As MAPIFolder '**
> >> Dim email As MailItem
> >> Dim Atmt As Attachment
> >> Dim i As Integer, Count As Integer
> >> Const FileName = "C:\ATT\"
> >> Set Inbox = GetNamespace("MAPI").GetDefaultFolder
> >> (olFolderInbox)
> >> Set EZBUYSubInbox = Inbox.Folders("EZBUY")
> >> Set JunkSubInbox = Inbox.Folders("Junk")
> >>
> >> Dim IE As New InternetExplorer
> >>
> >> i = 0
> >> If Inbox.Items.Count = 0 Then Exit Sub
> >> 'cycle through emails
> >> For Each email In Inbox.Items
> >> If email.UnRead Then '**
> >>
> >> If email.Subject = "PCO" Then
> >>
> >> If email.Attachments.Count > 0 Then
> >> For Count = email.Attachments.Count To 1 Step -1
> >> Set Atmt = email.Attachments.Item(Count)
> >> 'If LCase(Right(Atmt.FileName, 3)) = "wav" Or _
> >> ' LCase(Right(Atmt.FileName, 3)) = "xml"

> Then
> >> Atmt.SaveAsFile (FileName & Atmt.FileName)
> >>
> >>
> >> IE.Visible = False
> >> IE.navigate FileName & Atmt.FileName
> >>
> >> While IE.readyState = 4
> >> DoEvents
> >> Wend
> >>
> >> Do Until IE.Busy <> False
> >> DoEvents
> >> Loop
> >>
> >> IE.ExecWB 6, 2, 0, 0
> >>
> >>
> >> If Not EZBUYSubInbox Is Nothing Then
> >> ' email.Move EZBUYSubInbox
> >> End If
> >>
> >> 'Atmt.Delete
> >> i = i + 1
> >> 'End If
> >> Next Count
> >> ' email.Save
> >> End If
> >>
> >> Else
> >> email.Move JunkSubInbox
> >>
> >> End If
> >> End If '**
> >> Next email
> >> If i > 0 Then
> >> 'MsgBox " " & i & " attached files were found." _
> >> ' & vbCrLf & "They have been copied to your work
> >> folder." _
> >> ' & vbCrLf & vbCrLf & "Have a nice day.",
> >> vbInformation, "Finished!"
> >> End If
> >> GetAttachments_exit:
> >> Set Atmt = Nothing
> >> Set email = Nothing
> >> Set Inbox = Nothing
> >> Set EZBUYSubInbox = Nothing
> >> Set JunkSubInbox = Nothing
> >> Set IE = Nothing
> >> Exit Sub
> >> GetAttachments_err:
> >> MsgBox "An unexpected error has occurred." _
> >> & vbCrLf & "Please note and report the following
> >> information." _
> >> & vbCrLf & "Macro Name: GetAttachments" _
> >> & vbCrLf & "Error Number: " & Err.Number _
> >> & vbCrLf & "Error Description: " & Err.Description

> _
> >> , vbCritical, "Error!"
> >> Resume GetAttachments_exit

> >
> >
> >.
> >



  Reply With Quote
Old 06-05-2004, 06:04 PM   #5
Osama
Guest
 
Posts: n/a
Default Re: Error printing html file using IE object model in outlook

Exactly, when I step through the code it doeen't reach
GetAttachmnet_err and works fine. I made the changes
you've suggested to me and it is doing the same thing!!
>-----Original Message-----
>Are you saying that when you step through the code, it

never reaches
>GetAttachments_err? If so, that IS weird.
>
>--
>Eric Legault - B.A, MCP, MCSD, Outlook MVP
>--------------------------------------------------
>Job: http://www.imaginets.com
>Blog: http://blogs.officezealot.com/legault/
>
>
>"Osama Yahya" <osamay@lasernetworks.com> wrote in message
>news:812701c431d5$99736c50$a101280a@phx.gbl...
>> Hi Eric:
>> Thanks for your reply, I will try to change the email to
>> object instead of MailItem....but before I make the
>> changes I just wanted to mention that When I run the

macro
>> in debuggung mode it works fine, I am having the error
>> only when I run normaly.
>> >-----Original Message-----
>> >The only problem I see is your declaration of the email

>> variable. Change
>> >that to Dim email As Object. If there are any non-

email
>> messages in that
>> >folder, an error will be generated because the items

are
>> of a different
>> >class.
>> >
>> >--
>> >Eric Legault - B.A, MCP, MCSD, Outlook MVP
>> >--------------------------------------------------
>> >Job: http://www.imaginets.com
>> >Blog: http://blogs.officezealot.com/legault/
>> >
>> >
>> >"Osama Yahya" <osamay@lasernetworks.com> wrote in

message
>> >news:7c7001c4314c$63de8720$a301280a@phx.gbl...
>> >> Hi there:
>> >> I have a macro in outlook that prints html attachment
>> >> using IE object model and I am getting ExecWB failed

>> error
>> >> when I runs the macro, here is my code, any help is
>> >> appreciated.
>> >>
>> >> On Error GoTo GetAttachments_err
>> >> Dim Inbox As MAPIFolder
>> >> Dim EZBUYSubInbox As MAPIFolder '**
>> >> Dim JunkSubInbox As MAPIFolder '**
>> >> Dim email As MailItem
>> >> Dim Atmt As Attachment
>> >> Dim i As Integer, Count As Integer
>> >> Const FileName = "C:\ATT\"
>> >> Set Inbox = GetNamespace("MAPI").GetDefaultFolder
>> >> (olFolderInbox)
>> >> Set EZBUYSubInbox = Inbox.Folders("EZBUY")
>> >> Set JunkSubInbox = Inbox.Folders("Junk")
>> >>
>> >> Dim IE As New InternetExplorer
>> >>
>> >> i = 0
>> >> If Inbox.Items.Count = 0 Then Exit Sub
>> >> 'cycle through emails
>> >> For Each email In Inbox.Items
>> >> If email.UnRead Then '**
>> >>
>> >> If email.Subject = "PCO" Then
>> >>
>> >> If email.Attachments.Count > 0 Then
>> >> For Count = email.Attachments.Count To 1

Step -1
>> >> Set Atmt = email.Attachments.Item(Count)
>> >> 'If LCase(Right(Atmt.FileName, 3)) = "wav"

Or _
>> >> ' LCase(Right(Atmt.FileName, 3)) = "xml"

>> Then
>> >> Atmt.SaveAsFile (FileName & Atmt.FileName)
>> >>
>> >>
>> >> IE.Visible = False
>> >> IE.navigate FileName & Atmt.FileName
>> >>
>> >> While IE.readyState = 4
>> >> DoEvents
>> >> Wend
>> >>
>> >> Do Until IE.Busy <> False
>> >> DoEvents
>> >> Loop
>> >>
>> >> IE.ExecWB 6, 2, 0, 0
>> >>
>> >>
>> >> If Not EZBUYSubInbox Is Nothing Then
>> >> ' email.Move EZBUYSubInbox
>> >> End If
>> >>
>> >> 'Atmt.Delete
>> >> i = i + 1
>> >> 'End If
>> >> Next Count
>> >> ' email.Save
>> >> End If
>> >>
>> >> Else
>> >> email.Move JunkSubInbox
>> >>
>> >> End If
>> >> End If '**
>> >> Next email
>> >> If i > 0 Then
>> >> 'MsgBox " " & i & " attached files were found." _
>> >> ' & vbCrLf & "They have been copied to your work
>> >> folder." _
>> >> ' & vbCrLf & vbCrLf & "Have a nice day.",
>> >> vbInformation, "Finished!"
>> >> End If
>> >> GetAttachments_exit:
>> >> Set Atmt = Nothing
>> >> Set email = Nothing
>> >> Set Inbox = Nothing
>> >> Set EZBUYSubInbox = Nothing
>> >> Set JunkSubInbox = Nothing
>> >> Set IE = Nothing
>> >> Exit Sub
>> >> GetAttachments_err:
>> >> MsgBox "An unexpected error has occurred." _
>> >> & vbCrLf & "Please note and report the following
>> >> information." _
>> >> & vbCrLf & "Macro Name: GetAttachments" _
>> >> & vbCrLf & "Error Number: " & Err.Number _
>> >> & vbCrLf & "Error Description: " &

Err.Description
>> _
>> >> , vbCritical, "Error!"
>> >> Resume GetAttachments_exit
>> >
>> >
>> >.
>> >

>
>
>.
>

  Reply With Quote
Old 10-05-2004, 09:54 PM   #6
Eric Legault [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Error printing html file using IE object model in outlook

All I can say is that the first error I got was because I didn't have a
C:\ATT folder. I created that, and the code loops continuously at the While
IE.readyState = 4
section; IE never loads, and my PC goes to 100% CPU utilization and does
nothing - I have to stop the code. Maybe try your code with the Web Browser
Control stuff commented out and see if it behaves the same way.

What error message do you get, BTW? You never did say.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/


"Osama" <osamay@lasernetworks.com> wrote in message
news:95d201c4338c$3abfc1a0$a601280a@phx.gbl...
> Exactly, when I step through the code it doeen't reach
> GetAttachmnet_err and works fine. I made the changes
> you've suggested to me and it is doing the same thing!!
> >-----Original Message-----
> >Are you saying that when you step through the code, it

> never reaches
> >GetAttachments_err? If so, that IS weird.
> >
> >--
> >Eric Legault - B.A, MCP, MCSD, Outlook MVP
> >--------------------------------------------------
> >Job: http://www.imaginets.com
> >Blog: http://blogs.officezealot.com/legault/
> >
> >
> >"Osama Yahya" <osamay@lasernetworks.com> wrote in message
> >news:812701c431d5$99736c50$a101280a@phx.gbl...
> >> Hi Eric:
> >> Thanks for your reply, I will try to change the email to
> >> object instead of MailItem....but before I make the
> >> changes I just wanted to mention that When I run the

> macro
> >> in debuggung mode it works fine, I am having the error
> >> only when I run normaly.
> >> >-----Original Message-----
> >> >The only problem I see is your declaration of the email
> >> variable. Change
> >> >that to Dim email As Object. If there are any non-

> email
> >> messages in that
> >> >folder, an error will be generated because the items

> are
> >> of a different
> >> >class.
> >> >
> >> >--
> >> >Eric Legault - B.A, MCP, MCSD, Outlook MVP
> >> >--------------------------------------------------
> >> >Job: http://www.imaginets.com
> >> >Blog: http://blogs.officezealot.com/legault/
> >> >
> >> >
> >> >"Osama Yahya" <osamay@lasernetworks.com> wrote in

> message
> >> >news:7c7001c4314c$63de8720$a301280a@phx.gbl...
> >> >> Hi there:
> >> >> I have a macro in outlook that prints html attachment
> >> >> using IE object model and I am getting ExecWB failed
> >> error
> >> >> when I runs the macro, here is my code, any help is
> >> >> appreciated.
> >> >>
> >> >> On Error GoTo GetAttachments_err
> >> >> Dim Inbox As MAPIFolder
> >> >> Dim EZBUYSubInbox As MAPIFolder '**
> >> >> Dim JunkSubInbox As MAPIFolder '**
> >> >> Dim email As MailItem
> >> >> Dim Atmt As Attachment
> >> >> Dim i As Integer, Count As Integer
> >> >> Const FileName = "C:\ATT\"
> >> >> Set Inbox = GetNamespace("MAPI").GetDefaultFolder
> >> >> (olFolderInbox)
> >> >> Set EZBUYSubInbox = Inbox.Folders("EZBUY")
> >> >> Set JunkSubInbox = Inbox.Folders("Junk")
> >> >>
> >> >> Dim IE As New InternetExplorer
> >> >>
> >> >> i = 0
> >> >> If Inbox.Items.Count = 0 Then Exit Sub
> >> >> 'cycle through emails
> >> >> For Each email In Inbox.Items
> >> >> If email.UnRead Then '**
> >> >>
> >> >> If email.Subject = "PCO" Then
> >> >>
> >> >> If email.Attachments.Count > 0 Then
> >> >> For Count = email.Attachments.Count To 1

> Step -1
> >> >> Set Atmt = email.Attachments.Item(Count)
> >> >> 'If LCase(Right(Atmt.FileName, 3)) = "wav"

> Or _
> >> >> ' LCase(Right(Atmt.FileName, 3)) = "xml"
> >> Then
> >> >> Atmt.SaveAsFile (FileName & Atmt.FileName)
> >> >>
> >> >>
> >> >> IE.Visible = False
> >> >> IE.navigate FileName & Atmt.FileName
> >> >>
> >> >> While IE.readyState = 4
> >> >> DoEvents
> >> >> Wend
> >> >>
> >> >> Do Until IE.Busy <> False
> >> >> DoEvents
> >> >> Loop
> >> >>
> >> >> IE.ExecWB 6, 2, 0, 0
> >> >>
> >> >>
> >> >> If Not EZBUYSubInbox Is Nothing Then
> >> >> ' email.Move EZBUYSubInbox
> >> >> End If
> >> >>
> >> >> 'Atmt.Delete
> >> >> i = i + 1
> >> >> 'End If
> >> >> Next Count
> >> >> ' email.Save
> >> >> End If
> >> >>
> >> >> Else
> >> >> email.Move JunkSubInbox
> >> >>
> >> >> End If
> >> >> End If '**
> >> >> Next email
> >> >> If i > 0 Then
> >> >> 'MsgBox " " & i & " attached files were found." _
> >> >> ' & vbCrLf & "They have been copied to your work
> >> >> folder." _
> >> >> ' & vbCrLf & vbCrLf & "Have a nice day.",
> >> >> vbInformation, "Finished!"
> >> >> End If
> >> >> GetAttachments_exit:
> >> >> Set Atmt = Nothing
> >> >> Set email = Nothing
> >> >> Set Inbox = Nothing
> >> >> Set EZBUYSubInbox = Nothing
> >> >> Set JunkSubInbox = Nothing
> >> >> Set IE = Nothing
> >> >> Exit Sub
> >> >> GetAttachments_err:
> >> >> MsgBox "An unexpected error has occurred." _
> >> >> & vbCrLf & "Please note and report the following
> >> >> information." _
> >> >> & vbCrLf & "Macro Name: GetAttachments" _
> >> >> & vbCrLf & "Error Number: " & Err.Number _
> >> >> & vbCrLf & "Error Description: " &

> Err.Description
> >> _
> >> >> , vbCritical, "Error!"
> >> >> Resume GetAttachments_exit
> >> >
> >> >
> >> >.
> >> >

> >
> >
> >.
> >




  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off