Sending message to another PC

M

macroapa

Hi, I have a networked PC that has a word doc that continually runs
some VBA code throughout the day.

What I would like to do is to add some code so that if it errors, it
goes to the error handler and sends a message to my pc (on the
network) to let me know that there is an error.

I know how to do it with outlook, but the outlook safety net kicks in
and you have to be at the PC to 'OK' the email to be sent... which
defeats the point!

Is there a way I can get it to send a message to another PC?

Thanks
 
D

Doug Robbins - Word MVP

I have been developing an application involving mailmerging to email and
using the following code with Office 2007 or 2010, does not result in the
prompt that I recall used to occur that necessitate using the "Express
ClickYes" utility that is available as a free download from:

http://www.contextmagic.com/express-clickyes/

Dim oOutlookApp As Object
Dim oItem As Object
On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If
Set oItem = oOutlookApp.CreateItem(0) 'olMailItem
With oItem
.To = Datarray(j, Email)
.Subject = "Problem"
.BodyFormat = 1 'olFormatPlain
.Body = "There is a Problem
.Send
End With
Set oItem = Nothing
Set oOutlookApp = Nothing
' Close Outlook if it was started by this macro.
If bStarted Then
oOutlookApp.Quit
End If

If the above code still results in a prompt, you can probably use Express
ClickYes, which is a tiny program that sits in the taskbar and clicks the
Yes button on behalf of you, when Outlook's Security Guard opens a prompt
dialog saying that a program is trying to send an email with Outlook or
access its address book. You can suspend/resume it by double-clicking its
taskbar icon. Developers can automate its behaviour by sending special
messages.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top