Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 07/Outlook 07 Problem

Status
Not open for further replies.
Nov 29, 2006
11
US
I'm having this very weird problem at work. When a button is clicked this code below is executed. The code searches to make sure an Outlook program is running and if it isn't opens it. It also opens a click yes program that will hit yes when pop up comes up that access is trying to send an email through outlook. Here is the code:

Private Sub emailloader_Click()
On Error Resume Next

Dim strError As String
Dim wnd As Long
Dim uClickYes As Long
Dim Res As Long
Dim varRetVal As Variant
Dim Olook As Outlook.Application

Set Olook = GetObject(, "Outlook.Application")

If Olook Is Nothing Then

varRetVal = Shell("C:\Program Files\Microsoft Office\Office12\outlook.exe")
Olook.ActiveExplorer.WindowState = 1

End If

varRetVal = Shell("C:\Program Files\Express ClickYes\ClickYes.exe")

uClickYes = RegisterWindowMessage("CLICKYES_SUSPEND_RESUME")

wnd = FindWindow("EXCLICKYES_WND", 0&)

Res = sendmessage(wnd, uClickYes, 1, 0)
On Error GoTo Print_Err
DoCmd.SendObject acSendReport, "report", acFormatPDF, "$$$$$@###.com", , , "Test", , False


AfterPrint:
Res = sendmessage(wnd, uClickYes, 0, 0)

Exit Sub
Print_Err:
If Err.Number = 2501 Then
Resume AfterPrint
Else
MsgBox Err.Description
Resume AfterPrint
End If
End Sub

The code works fine on my computer. But when I try to run the exact same code on another computer it will go through the process but end up telling me that "Microsoft Access can't send this email." I've tried debugging this and found another weird thing. On the computer where it does not work I started to F8 through the code and once I got to the code that reads

varRetVal = Shell("C:\Program Files\Microsoft Office\Office12\outlook.exe")

Outlook would open, but it would open in 256 color and change the resolution to 640 x 480. I found out that it was changing the display setting for when you opened Outlook but I have no idea how it did.

I know this issue is not because of the libraries used because all the ones that make the code work on my computer are all checked on the computer where this is happening. Any help on this issue would be greatly appreciated.
 
What about replacing this:
varRetVal = Shell("C:\Program Files\Microsoft Office\Office12\outlook.exe")
with this ?
Set Olook = CreateObject("Outlook.Application")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
But why would this work on one computer and not the other if was something to do with this code?
 
I suggested that just to make the following line of code working ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Any suggestions on my the other computer won't let me email from Access?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top