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.
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