Send File Path-Email via Groupwise

This is what I had to do lots of times. Send the file path of an Excel workbook to my supervisor. So I created this macro to send the activeworkbook full file path to the specified user. This can actually be well modified to create an AddIn, but for now, this is what is going to be. Insert a module in the personal.xls and insert this code. A reference to “Groupware Type library” is a must to make this macro work.

Option Explicit
Private ogwApp As GroupwareTypeLibrary.Application
Private ogwRootAcct As GroupwareTypeLibrary.Account
Sub SendEmail()

Dim strRecipient As String
On Error GoTo SendEmail_Error
strRecipient = InputBox(“Enter the email address of recepient”, “Recipient Name”)
If strRecipient = “” Then
    MsgBox “No Recipient specified”, vbCritical
    Exit Sub
End If
Const NGW$ = “NGW”
Dim ogwNewMessage As GroupwareTypeLibrary.Mail
Dim StrSubject As String, StrBody As String
Dim strWkbkName As String, strWkbkPath As String
strWkbkName = ActiveWorkbook.Name
StrSubject = strWkbkName & “-File”
strWkbkPath = ActiveWorkbook.Path
StrBody = “Please find the file-” & strWkbkName & ” here- ” & strWkbkPath & “\” & strWkbkName
StrBody = StrBody & vbCrLf & vbCrLf & “Thanks”
If ogwApp Is Nothing Then ‘Need to set object reference
        DoEvents
        Set ogwApp = CreateObject(“NovellGroupWareSession”)
        DoEvents
End If
Dim StrLoginName As String, StrMailPassword As String
Set ogwRootAcct = ogwApp.Login
Set ogwNewMessage = ogwRootAcct.WorkFolder.Messages.Add(“GW.MESSAGE.MAIL”, egwDraft)
DoEvents
With ogwNewMessage
        .Recipients.Add (strRecipient)
         ‘Assign the SUBJECT text
        .Subject = StrSubject
         ‘Assign the BODY text
         .BodyText = StrBody
         ‘Send the message
        .Send
        DoEvents
End With
   On Error GoTo 0
   Set ogwRootAcct = Nothing
   Set ogwNewMessage = Nothing
   Set ogwApp = Nothing
   Exit Sub
SendEmail_Error:
    MsgBox “Error ” & Err.Number & ” (” & Err.Description & “) in procedure SendEmail”
    Set ogwRootAcct = Nothing
   Set ogwNewMessage = Nothing
   Set ogwApp = Nothing
End Sub

‘http://www.phhp.ufl.edu/~smanamal/misc/Groupwise.htm
‘http://www.vbaexpress.com/kb/getarticle.php?kb_id=277

About the Author

A co-author of Data Science for Fundraising, an award winning keynote speaker, Ashutosh R. Nandeshwar is one of the few analytics professionals in the higher education industry who has developed analytical solutions for all stages of the student life cycle (from recruitment to giving). He enjoys speaking about the power of data, as well as ranting about data professionals who chase after “interesting” things. He earned his PhD/MS from West Virginia University and his BEng from Nagpur University, all in industrial engineering. Currently, he is leading the data science, reporting, and prospect development efforts at the University of Southern California.

>