Minimizing Oulook from Access

I have a module that opens Outlook and sends an email notification. The code I used for this is customized off this code:

http://www.everythingaccess.com/tutorials.asp?ID=Outlook-Send-E-mail-Without-Security-Warning

Does anyone know of a way to minimize Outlook from Access? I have tried a couple of methods I found online with no success.

Code:
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_MINIMIZE As Long = 6

sub hideme()
dim hwnd as long
hwnd = findwindow(vbnullstring,"Inbox - Microsoft Outlook")
call showwindow(hwnd,SW_MINIMIZE)
end sub
 
So should this go in Access? And if so, where is it called?
 
This is working - my code is still exposed briefly in the existing window. I hate saying it will just have to do -
 
You would need to put that could into a public module and call the sub from your code. This code does assume that Outlook is opening to the Inbox, if it is not then the above code will probably not work.
 
Are you talking about the outlook vba code window? If so you can put a password on the code to prevent wandering eyes.
 
Yeah - I figured that and changed the call a bit. I am now working on minimizing all windows before the Outlook call happens to see if I can disuade the code from attaching to an open window.

Thanks for your help.

Code:
Sub hideme()
Dim hwnd As Long
Dim hwmd As Long
hwmd = FindWindow(vbNullString, "Microsoft Visual Basic - VbaProject.OTM - [ThisOutlookSession (Code)]")
hwnd = FindWindow(vbNullString, "Inbox - Microsoft Outlook")
Call ShowWindow(hwnd, SW_MINIMIZE)
Call ShowWindow(hwmd, SW_MINIMIZE)
End Sub
 
The wandering eye doesn't concern me as much as the SEU - stupid end user. Oh - That was mean for a Tuesday morning.
 
LOL, might be mean but so true. You can right click the VBA project in outlook select properties and click lock project for viewing, this way even if the VBA window is opened they cannot see or edit the code.
 
If you only knew. We have some that can't even login unless they call and get walked through everyday and you use small words and speak slowly.
 
Oh I know, every time I build an idiot proof system they seem to build a better idiot.
 
Yep - I have those too! On the phone with one now.

I actually have to figure out a way to allow a database to extract data correctly no matter what the end user inputs for data to be calculated correctly because my boss tells me that he can't help it if they are stupid and his boss won't require them to do it right.

I have double checked everything. I still have a splash of code, showed my boss and he said that would have to do. The code isn't editable and even accessible. The things we do to get around Microsoft thinking for us.
 
Minimizing all the windows in Access - the VBA doesn't stick to any windows and it actually speeds it up a little. Rolling it out this afternoon - thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom