By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,510 Members | 1,445 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,510 IT Pros & Developers. It's quick & easy.

How To Call Function

100+
P: 135
I got this code form an old post on here, and I was wondering how to call this to run. What do I have to do to call/activate/run this function?


Public Function PrintPDFemail2()

DoCmd.OpenReport "rptJobItemStat", acViewNormal

Dim strEmail As String
Dim strMsg As String
Dim oLook As Object
Dim oMail As Object

Set oLook = CreateObject("Outlook.Application")
Set oMail = oLook.createitem(0)
With oMail
.to = "someone@email.com"
.body = "Attached is a PDF file for your viewing"
.Subject = "Job Item"
.Attachments.Add ("C:\Documents and
Settings\ron_m\Desktop\rptJobItemStat.pdf")

.Send

End With

Set oMail = Nothing
Set oLook = Nothing
End Function



Thanks
Nov 21 '08 #1
Share this Question
Share on Google+
2 Replies


puppydogbuddy
Expert 100+
P: 1,923
A simple way is to Call the function via code activated on the click of a button on the form like this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnEmail_Click()
  2.  
  3. Call PrintPDFemail2
  4.  
  5. End Sub
Nov 21 '08 #2

overcomer
P: 25
hi,

calling a function in vba is simple as the name of the function itself..

sub Proc_name()

function_name

end sub
Nov 24 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.