I have the following macro:
Dim olApp As Object, olMail As Object
Dim rngeAddresses As Range, rngeCell As Range
Set olApp = CreateObject("Outlook.Application")
intResponse = MsgBox(prompt:=".....", _
Buttons:=vbQuestion + vbYesNoCancel
On Error Resume Next
Select Case intResponse
Case vbYes
Set rngeAddresses = range("...")
Case vbNo
Set rngeAddresses = Application.InputBox(prompt:="........"
Case vbCancel
Cancel = True
End Select
On Error GoTo 0
For Each rngeCell In rngeAddresses.Cells
Set olMail = olApp.CreateItem
olMail.To = rngeCell.Value
Next
Why the button "Cancel" doesn't work,because I become an error?
Thanks for help.
Dim olApp As Object, olMail As Object
Dim rngeAddresses As Range, rngeCell As Range
Set olApp = CreateObject("Outlook.Application")
intResponse = MsgBox(prompt:=".....", _
Buttons:=vbQuestion + vbYesNoCancel
On Error Resume Next
Select Case intResponse
Case vbYes
Set rngeAddresses = range("...")
Case vbNo
Set rngeAddresses = Application.InputBox(prompt:="........"
Case vbCancel
Cancel = True
End Select
On Error GoTo 0
For Each rngeCell In rngeAddresses.Cells
Set olMail = olApp.CreateItem
olMail.To = rngeCell.Value
Next
Why the button "Cancel" doesn't work,because I become an error?
Thanks for help.