Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Error handler help

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

  #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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Error handler help

Hi,

Exactly what i was looking for. Thank you :)

Nigel

"KL" wrote:

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




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
Error handler linto Excel Discussion (Misc queries) 1 February 11th 10 12:17 PM
Error Handler Question Jenny B. Excel Discussion (Misc queries) 4 January 9th 08 05:16 PM
Error Handler sharad Excel Discussion (Misc queries) 1 September 17th 07 06:38 PM
Error Handler dht[_2_] Excel Programming 5 August 19th 04 08:51 AM
error handler Fleur Excel Programming 1 November 20th 03 06:06 AM


All times are GMT +1. The time now is 04:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"