Bypassing Outlook message when e-mailing from Word

J

Jane

We have upgraded to Outlook 2003 and are experiencing problems with a command
button in a Word 97 document which, when clicked, sends the Word document by
e-mail to a designated recipient. All works fine in Outlook 2000 but with
2003 a message appears on screen:

"A programme is trying to access e-mail addresses you have stored in
Outlook. Do you want to allow this?
If this is unexpected, it may be a virus and you should choose "No".
Allow Access for …
Yes No Help"

If we allow access for say 1 minute and click yes, and then yes again the
e-mail is sent.

We understand the message box is as a result of security settings in Outlook
2003. We'd prefer to leave the settings as they are and wondered if there is
some coding we can use to bypass this screen, ie put a tick in the box and
select yes and yes?

We have found some coding which may do the trick but cannot work out how we
incorporate it within our existing coding. This is:

' Declare Windows' API functions
Private Declare Function RegisterWindowMessage _
Lib "user32" Alias "RegisterWindowMessageA" _
(ByVal lpString As String) As Long

Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As Any, _
ByVal lpWindowName As Any) As Long

Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long

Private Sub SomeProc()
Dim wnd As Long
Dim uClickYes As Long
Dim Res As Long

' Register a message to send
uClickYes = RegisterWindowMessage("CLICKYES_SUSPEND_RESUME")
' Find ClickYes Window by classname
wnd = FindWindow("EXCLICKYES_WND", 0&)
' Send the message to Resume ClickYes
Res = SendMessage(wnd, uClickYes, 1, 0)
' ...
' Do some Actions
' ...
' Send the message to Suspend ClickYes
Res = SendMessage(wnd, uClickYes, 0, 0)
End Sub

Our VB code (located in Module1) to send the e-mail is:

Public Sub CmdSubmit_Click()
If Validate() Then
If MsgBox("Do you want to e-mail this document now?", vbQuestion +
vbYesNo) = vbYes Then
ActiveDocument.HasRoutingSlip = True
With ActiveDocument.RoutingSlip
.Subject = "New client/matter form"
.AddRecipient Recipient:="(e-mail address removed)"
.Message = "See the attached new client/matter form." & vbCrLf &
vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf &
vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf &
vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf
.Delivery = wdAllAtOnce
End With
ActiveDocument.Route
End If
End If
End Sub
 

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