PDA

View Full Version : Create Add-in?



ertuu85
02-14-2017, 09:20 AM
I created a macro project, just curious if there is a way to create an add-in that a user can double click and have it install on their outlook?

Logit
02-14-2017, 09:46 AM
http://www.fontstuff.com/vba/vbatut03.htm

https://msdn.microsoft.com/en-us/library/office/gg597509(v=office.14).aspx

ertuu85
02-14-2017, 09:48 AM
I actually opened up Visual Studio and opened a project for office outlook add-in.

Is there an easy way to convert this macro to vb?



Option Explicit

Sub prefixSubjectWithEncrypt()

Dim myItem As MailItem
Set myItem = ActiveInspector.CurrentItem

myItem.Display

If myItem.To = "" Then
MsgBox "You need at least one recipient"
Exit Sub
End If

myItem.Subject = "[encrypt]" & myItem.Subject
myItem.Send

End Sub


and assign it a button?

Logit
02-14-2017, 10:37 AM
Each of the email fields can be hard coded or reference a cell value:



With OutMail
.To = Sheets("Sheet1").Range("A1").Value_________ 'or it could be hardcoded like .To = "an_email@anywhere.com"
.Subject = "Testfile"____________________________ 'or Sheets("Sheet1").Range("B1").Value
.Body = "Hi "__________________________________' or Sheets("Sheet1").Range("C1").Value
.Send 'Or use .Display
End With


Then, to check for any empty fields:



If .To = "" Then
MsgBox "You need at least one recipient in the TO field"
Exit Sub
End If

If .Subject = "" Then
etc., etc.,



The above is the basics ... here is an example email project (attached):18369