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

How To Call Function

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 = ""
.body = "Attached is a PDF file for your viewing"
.Subject = "Job Item"
.Attachments.Add ("C:\Documents and


End With

Set oMail = Nothing
Set oLook = Nothing
End Function

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

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()
  3. Call PrintPDFemail2
  5. End Sub
Nov 21 '08 #2

P: 25

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

sub Proc_name()


end sub
Nov 24 '08 #3

Post your reply

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