huskerphil
MIS
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.
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.