Automation / Integration between VBA Applications


Call an Outlook Macro from other Applications
B
C
  1. Calling an Outlook Macro from another VBA enabled Application should work as is in any VBA application and appropriately tweaked in VBS.

    CallOLKSubFromApp ... Placed in the remote app to a call a named sub in the Outlook VBE
    ---------------------------------------------------------------------------------------
    strMacroName ... The Outlook Macro to be called
    strParam ... Optional string relating to parameters to be passed to the outlook macro).

    Library Calls:
    ---------------------------------------------------------------------------------------
    ApplicationCount - Establish if Outlook is already running

    Sub RunOLMacro(strMacroName as string, optional strParam as string) 
    Dim objOL As Object 
    Dim ctl As Object 
    Dim cbr As Object 
    Const msoControlButton = 1 
    Dim shell As Object 
       
        If ApplicationCount("outlook.exe") = 0 Then 
            Set shell = CreateObject("wscript.shell") 
            shell.Run "outlook.exe" 
        End If 
    '    shell.Run "outlook.exe /autorun ""remoteChangeViewFilter""" 
       
        Set objOL = CreateObject("Outlook.Application") 
        Set cbr = objOL.ActiveExplorer.CommandBars("Standard") 
        Set ctl = cbr.Controls.Add(Type:=msoControlButton) 
        ctl.Parameter = "Doris" 
        ctl.OnAction = "remoteChangeViewFilter" 
        ctl.Execute 
        ctl.Delete 
    End Sub

    remoteChangeViewFilter ... Placed in Outlook as thenamed sub called from the external Application
    ---------------------------------------------------------------------------------------
    param ... Optional string relating to parameters passed to the outlook macro).

    Sub remoteChangeViewFilter() 
    Dim param As Variant 
        param = Application.ActiveExplorer.CommandBars.ActionControl.Parameter 
        MsgBox param 
    End Sub
    Return to Module List

  2. B.

    .
    .

    Function TBD
    End Function
    Return to Module List

  3. C , .



    Return to Module List