none
Wanted to change VSTO property RRS feed

  • Question

  • Hi,

    I am sending mail via VB script in excel. But I have a requirement to send  that mail in secure format.There is VSTO addin in the outlook. I would like to access that object and change the property to S2  (usually it is S1).  So that mails would be secured but not sure how to achieve it.

    It would great help if someone could help me by step by procedure.

    Note : Currently I am able to send mail using  "With Out mail"

    Thanks,

    Balaji Raja K

    Monday, July 31, 2017 6:18 AM

All replies

  • Hello Balaji,

    You can access COM add-ins from Outlook macros using the COMAddIns property of the Application class which returns  a COMAddIns collection that represents all the Component Object Model (COM) add-ins currently loaded in Microsoft Outlook:

    Sub SetCellValue()
        Dim addin As COMAddIn
        Dim adxModule As Object
     
        Set addin = Application.COMAddIns.Item("YourAddinName")
        Set adxModule = addin.Object
     
        Call adxModule.CallYourAddinMethodOrProperty()
    End Sub

    You may find the HowTo: Communicate with a COM add-in from a standalone application article helpful.


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Monday, July 31, 2017 9:32 AM
  • Hello,

    You could follow Eugene's suggestion to call VSTO add-in methods in VBA using code above, but the method should be COM visiable. Please visit Calling Code in VSTO Add-ins from Other Office Solutions:

    To expose an object in your VSTO Add-in to other solutions, perform the following steps in your VSTO Add-in:

    1. Define a class that you want to expose to other solutions.

    2. Override the RequestComAddInAutomationService method in the ThisAddIn class. Return an instance of the class that you want to expose to other solutions.

    Walkthrough: Calling Code in a VSTO Add-in from VBA  demonstrates how to expose an object in a VSTO Add-in to other Microsoft Office solutions, including Visual Basic for Applications (VBA) and COM VSTO Add-ins.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, August 1, 2017 1:47 AM
    Moderator
  • Hi Eugene, Celeste,

    As I am new to VB script, I am not sure if I understand correctly. I have written below code to find the addin item & progid based on below code.

     Set Olappl = CreateObject("Outlook.Application")
     Dim addin As COMAddIn

        For i = 1 To Olappl.COMAddIns.Count

            Set addin = Olappl.COMAddIns.Item(i)
            If addin = "Privacy for Outlook  S1, S2, S3" Then
                MsgBox (addin.progID)
                MsgBox (addin.Object) ' it is throwing error
                Exit For
            End If
        Next i

    Am able to identify the PROGID of addin using above code. But not sure how to identify the right method to set the secure mail before sending.

    Can you please guide me how should I proceed from here. Because I am not sure which method should be called to set the privacy/property to S2 instead of S1 which is default. 

    I am using VB 6.5 & Excel 2007. The Privacy addin which already exists in Outlook 2007.

    Thanks,

    Balaji Raja K


    • Edited by BalajiRajaK Tuesday, August 1, 2017 11:06 AM
    Tuesday, August 1, 2017 11:02 AM
  • Hello,

    The method which you want to call in VBA should be COM visible and you should know its name. According to your description, it seems that you want to call a method in an add-in which is existing. I think you are unable call the method because you have no idea if the method is COM visible and you dont know the method name.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 2, 2017 6:21 AM
    Moderator