![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 1,288
|
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. |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Where is this code situated? I'm guessing that it's in a worksheet event, based upon:
I would suggest using "Exit Sub" instead of Cancel = True, assuming that all you want to do is to stop the sub routine should the user choose to "Cancel". HTH |
|
|
|
|
|
#3 | |
|
Board Regular
Join Date: Mar 2002
Posts: 1,288
|
Quote:
Many thanks for your time. |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|