View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Error handler help

Hi Nigel,

Try this:

If Range ("D12") = "" Then
MsgBox ("Contact must have email address"), , _
" Contacts message"
Exit Sub
Else
'Your instructions to send e-mail here
End If

Reagrds,
KL


"Nigel" wrote in message
...
Hi,
i am new to VB code but seem to be getting ok okish. i do however have a
problem with a routine. i press a button to email my contact in the excel
w/book. if there is a mail there, it sends etc. if the specific cell is
empty, it returns an error which i have to debug. can any one help me with
a
handler for this. Here is mine but its not very good and prbably not
correct.( my email address appears in D12)

on Error GoTo ErrorHandler1 ( at top of routine )

End If
Range ("D12") = ""
GoTo ErrorHandler1
Exit Sub

ErrorHandler1:
MsgBox ("Contact must have email address"), , _
" Contacts message"
End Sub

help would be well received :)

Nigel