Use Excel VB code to Send Attachment from Zimbra Desktop
Excel 2007
Windows XP
Zimbra Desktop 1.0.4 (build 1833)
I would like to send a pdf file from my Excel VBA code through Zimbra desktop. The cells that I reference in my code have the proper paths and file names required to provide an email, subject and attachment.
I have uploaded a text file to my post, which shows how I am already allowing a user who has outlook to send a pdf. But when I tried to do the same thing using a shell command, zimbra desktop pops up, but it has not opened a new message, and it has not attached the pdf.
Unfortunately, I am unfamiliar with enough of the zimbra commands to pass an email, subject or attachment correctly .
I found this Reference case, but it does not quite show me all of the commands/steps I need.
'http://www.zimbra.com/forums/developers/37439-trying-create-zimbra-desktop-mapi-dll.html
My Code so far
-----------------------------------
Private Sub SendZimbra_Click()
Dim SH As Worksheet, TP As Worksheet
Set TP = Sheets("Template")
Set SH = Sheets("Purchased Items")
EmailAnswer = MsgBox("Create Email Now ?", vbYesNo)
If EmailAnswer = 6 Then
'Start Email Creation Process. 6 = Yes, 7 = No
Dim directory As String
Dim ZimbraPath As String, activedocument As Workbook
ZimbraPath = SH.Cells(1, 21)
directory = SH.Cells(3, 3)
AttachementName = SH.Cells(3, 3) & SH.Cells(2, 3) & " Packing Slip.pdf" 'Attachment Name & Location
SubjectName = SH.Cells(4, 3) 'Cell C4 has the subject name
EmailTo = SH.Cells(5, 3)
If AttachementName <> "" Then
On Error GoTo 1
Shell (ZimbraPath & " -sendfile " & AttachementName)
End If
err_handler:
1
'MsgBox "PDF File does not exist !" & vbCrLf & "Create PDF, then Try Again." & vbCrLf & vbCrLf & "File Name : " & AttachementName
'Resume Next 'Ignors the error
If Err.Description <> "" Then MsgBox Err.Description
' End 'End the email creation
End If 'End creating email
End Sub