Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    mercapto is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jan 2012
    Location
    Spain
    Posts
    91

    Quote Originally Posted by June7 View Post
    Try:

    Shell SysCmd(acSysCmdAccessDir) & "Outlook.exe"
    Great!! This is working.

    For an "A"... How could I run the app minimized? And how could I close this Outlook window at the end of the task??

    Thanks a lot. Great forum.

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,631
    I don't know how to minimize Outlook from Access VBA.

    Only way I know to close an app from Access VBA is to kill all processes of the app. Don't ask me to explain this code - I found it and just know it works for my requirements.

    ' ProcessKillLocal.vbs
    ' Sample VBScript to kill a program
    ' Author Guy Thomas http://computerperformance.co.uk/
    ' Version 2.7 - December 2010
    ' ------------------------ -------------------------------'
    Option Explicit
    Dim objWMIService, objProcess, colProcess
    Dim strComputer, strProcessKill
    strComputer = "."
    strProcessKill = "'outlook.exe'"
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
    For Each objProcess in colProcess
    objProcess.Terminate()
    Next
    'WSCript.Echo "Just killed process " & strProcessKill & " on " & strComputer
    'WScript.Quit
    'End of WMI Example of a Kill Process
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #18
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I never got it to work real well but, I modified the code I linked to in post #4 to send outlook to the task tray. I say tray verses task bar. Let me know if that is something you want to explore. It can be done. It just confused the user so I reverted. Not sure if it can be modified to Task "BAR"

  4. #19
    mercapto is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jan 2012
    Location
    Spain
    Posts
    91
    Finally I decided to use the open outlook code provided by June7, placing it in this part of the code:

    If Err Then 'Outlook is not open
    OpenOutlook
    Set olApp = CreateObject("Outlook.Application") 'Create a new instance of Outlook
    End If

    I configured outlook to launch minimized by editing in the Start menu properties
    The pro is that I don't spend time and resources closing outlook when I am probably using it next. The con is that I have to manually close it when I finish.

    So...
    Quote Originally Posted by ItsMe View Post
    I never got it to work real well but, I modified the code I linked to in post #4 to send outlook to the task tray. I say tray verses task bar. Let me know if that is something you want to explore. It can be done. It just confused the user so I reverted. Not sure if it can be modified to Task "BAR"
    that would be great. User doesn't need to know outlook is there, just that is working.

  5. #20
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    The issue I never resolved is every time the user fired the request via a control, it would put Outlook in the tray regardless if it was already open. Calling the function would hide Outlook if it was already running.

    I just need to find a way to call the "Hide" part in an If Then statement.

  6. #21
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I started digging through how I go about checking for and launching Outlook. I am polishing up my existing code and will import it into a blank DB to post here at a later time. Meanwhile, here is code to act like you are launching Outlook from the start menu with a twist. It puts in the "Task Tray". The downfall is this code snipit will always put it in the Task Tray. You have to select when you call it and this is what I am working to resolve.

    Open Outlook and have it runn in the Task Tray:
    stAppName = "C:\Program Files\Microsoft Office\OFFICE11\Outlook.exe" 'Locate the app's .EXE file
    Call Shell(stAppName, vbMinimizedFocus)

    PS:
    You need to verify the directory for your version of Outlook.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. My query code doesn't work
    By blacksaibot in forum Programming
    Replies: 2
    Last Post: 03-08-2012, 02:59 PM
  2. Replies: 1
    Last Post: 12-20-2011, 08:15 PM
  3. Menu doesn't open after TransferDatabase
    By ghillie30 in forum Access
    Replies: 6
    Last Post: 10-27-2011, 06:56 AM
  4. Form doesn't open in Dialog mode
    By accessnewb in forum Programming
    Replies: 3
    Last Post: 08-02-2011, 08:38 AM
  5. Replies: 3
    Last Post: 12-09-2010, 11:50 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums