Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding pdf as attachment in Groupwise through VBA

Status
Not open for further replies.

ALRice

Programmer
Jul 17, 2003
11
0
0
US
Hi all,

I have been searching and searching and searching.... I found several comments, and even one thread that looked promising, but no such luck. What I am trying to do is have access check the date of an audit that is due. If the date matches todays date it will send an email, through Groupwise, with the appropriate pdf form (path and file name created as string) to the project manager. I manage to get the email to come up for editing, , but it does not attach the pdf. below is the code that i am trying out...


Private Sub Form_Current()
Dim Path As String
Dim docname As String
Dim Attchmnt As String
Path = "C:\Documents and Settings\Audit Forms\"
docname = [TaskDescription] & ".pdf"
Attchmnt = Path & docname

If [AuditDate] = Date Then

DoCmd.SendObject , , , "me@myemail.com", , , "Audit Due", " Attached is the Audit tool for the " & [TaskDescription] & " Audit. Please print, complete and return to me as soon as possilbe.", -1, Attchmnt

End If
End Sub


Thank you for all your wonderful insights!

Autumn



Aim for the moon, for even if we miss, we are still among the stars.
 
I got it to work! yay me!

Aim for the moon, for even if we miss, we are still among the stars.
 
is there anyway to get this to work in vbscript? i use groupwise, but i can't get it to send from vbscript. i guess my question is, what do i replace docmd with, in vbscript?
 
Hi Jfdabiri.

I was able to attach a pdf to groupwise using vba on form open, you could edit it to run on the button click. I had to direct the location of the attachment. It is a bit long winded and not very pretty but it has worked for me.


Private Sub Form_Open(Cancel As Integer)
Dim Path As String
Dim docname As String
Dim Attchmnt As String
Dim Rcpnt As String




Path = "O:\Path of document to send"
docname = [TaskDescription] & ".pdf"
Attchmnt = Path & docname
Rcpt = [Person to Send to]



'*****************************************************
'Requires Groupware Type Library reference
'*****************************************************

Dim gwapp As GroupwareTypeLibrary.Application
Dim gwmessage As GroupwareTypeLibrary.Message
Dim gwaccount As GroupwareTypeLibrary.Account
Dim gwrecipient As GroupwareTypeLibrary.Recipient

Set gwapp = New GroupwareTypeLibrary.Application
Set gwaccount = gwapp.Login()

Set gwmessage = gwaccount.MailBox.Messages.Add

With gwmessage

.Subject = "Email Subject"
.FromText = [ReportTo]
.bodytext = " Body of Email" & Chr(10) & Chr(10) & Chr(10) & "Please print, complete and return to " & [Report To] & "."


.Attachments.Add Attchmnt
' .Attachments.Add "Your File 2"
' .Attachments.Add "Your File 3"

End With

Set gwrecipient = gwmessage.Recipients.Add(Rcpt)

With gwrecipient

.EmailType = ""
' .DisplayName = "Display Name of Recipient" 'Optional
.Resolve

End With


gwmessage.send

'Set gwrecipient = Nothing
'Set gwmessage = Nothing
'Set gwaccount = Nothing
'Set gwapp = Nothing

End Sub



Best of Luck

Aim for the moon, for even if we miss, we are still among the stars.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top