Trying to call an addin within Outlook when sending as email attachment from MS Office Application

Having a problem with an Outlook addin, that was created using VSTO.

If Outlook is open and I am in Word or any other MS Office application and I go to File, send as email attachment, everything works great. When Outlook is closed and if I right click on the document, say on either my local or network drive, and go to send to mail recipient everything is fine.

However, if Outlook is closed and and I am in an Office application such as word or excel and I go to File, send as email attachment for some reason the addin does not seem to be getting called.  I am not sure if there's a workaround for this or not. Any help would be appreciated..

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Helen FeddemaCommented:
Here is some code I use to either set a reference to an existing Outlook instance, or create a new one if needed:
Dim appOutlook As Outlook.Application

   Set appOutlook = GetObject(, "Outlook.Application")

   'Your code here

   Set appOutlook = Nothing
   Exit Sub

   'Outlook is not running; open Outlook with CreateObject
   If Err.Number = 429 Then
      Set appOutlook = CreateObject("Outlook.Application")
      Resume Next
      MsgBox "Error No: " & Err.Number _
         & " in *** procedure" _
         & "; Description: " & Err.Description
      Resume ErrorHandlerExit
   End If

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Helen FeddemaCommented:
Alternately, you can declare the appOutlook variable as New Outlook.Application, and then close it from the ErrorHandlerExit code.  This method seems to work better for Office 2007 or higher.
TracyVBA DeveloperCommented:
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.