A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook Function help



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 28th 08, 07:22 PM posted to microsoft.public.outlook.program_vba
JC
external usenet poster
 
Posts: 41
Default Outlook Function help

Help new at functions-
Have
..Form![e-mailAddress], "Medco Finance Contracts Admin", "Manual Billing
Request. Adjustment Form", "Please review the attached document, Approve or
Reject by Email. Please email Medco Finance Contracts Admin the revised
Form." & Chr(10) & Chr(10) & "Thank you!" & Chr(10) & Chr(10) & "Adjustment
Administrator" & Chr(10) & Chr(10), "Billing Request Adjustment",
"S:\Finance\FISD\Adjustments\Snapshots\data.sn p", "Approved; Rejected", 2,
True
End Sub

Function fctnOutlook(Optional FromAddr, Optional Addr, Optional CC, Optional
BCC, _
Optional Subject, Optional MessageText, Optional Categories, Optional
AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

'Set StrCC = [Form]![e_mailAddress]
'Set ActiveControl = e_mailAddress
'Me.ActiveControl = e_mailAddress
'Set olCC = [Approver].Form![e-mailAddress]
'Set olCC = [Approver].Form![e-mailAddress]

With objOutlookMsg
If Not IsMissing(FromAddr) Then
.SentOnBehalfOfName = FromAddr
End If

If Not IsMissing(Addr) Then
Set objOutlookRecip = .Recipients.Add(Addr)
objOutlookRecip.Type = olTo
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC

End If

If Not IsMissing(BCC) Then
Set objOutlookRecip = .Recipients.Add(BCC)
objOutlookRecip.Type = olBCC
End If

If Not IsMissing(Subject) Then
.Subject = Subject
End If

If Not IsMissing(MessageText) Then
.Body = MessageText
End If

If Not IsMissing(Categories) Then
.Categories = Categories
End If

If Not IsMissing(AttachmentPath) Then
'Check file exists before attaching!
If Len(Dir(AttachmentPath)) 0 Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
Else
MsgBox "Attachment not found.", vbExclamation
End If
End If

If IsNull(Vote) = False Then
.VotingOptions = Vote
End If

Select Case Urgency
Case 2
.Importance = olImportanceHigh
Case 0
.Importance = olImportanceLow
Case Else
.Importance = olImportanceNormal
End Select

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

If EditMessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing

End Function

need to specify form link for field in form for cc option
[Approver].Form![e-mailAddress] anyone have any ideas.
Ads
  #2  
Old January 28th 08, 07:37 PM posted to microsoft.public.outlook.program_vba
JC
external usenet poster
 
Posts: 41
Default Outlook Function help

Changed code to and I now can generate one e-mail address code for outlook ;
fails
for multiple recipiets
Private Sub CmdSendEmail_Click()
fctnOutlook , Me.e_mailAddress, Me.e_mailAddress, "Medco Finance Contracts
Admin", "Manual Billing Request. Adjustment Form", "Please review the
attached document, Approve or Reject by Email. Please email Medco Finance
Contracts Admin the revised Form." & Chr(10) & Chr(10) & "Thank you!" &
Chr(10) & Chr(10) & "Adjustment Administrator" & Chr(10) & Chr(10), "Billing
Request Adjustment", "S:\Finance\FISD\Adjustments\Snapshots\data.sn p",
"Approved; Rejected", 2, True
End Sub

Function fctnOutlook(Optional FromAddr, Optional Addr, Optional CC, Optional
BCC, _
Optional Subject, Optional MessageText, Optional Categories, Optional
AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim STRcc As String


Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

'Set StrCC = [Form]![e_mailAddress]
'Set ActiveControl = e_mailAddress
'Me.ActiveControl = e_mailAddress
'Set olCC = [Approver].Form![e-mailAddress]
'Set olCC = Me.e_mailAddress
STRcc = Me.e_mailAddress


"JC" wrote:

Help new at functions-
Have
.Form![e-mailAddress], "xxxx", "Manual Billing
Request. Adjustment Form", "Please review the attached document, Approve or
Reject by Email. Please email xxxx Admin the revised
Form." & Chr(10) & Chr(10) & "Thank you!" & Chr(10) & Chr(10) & "Adjustment
Administrator" & Chr(10) & Chr(10), "Billing Request Adjustment",
"S:\Finance\FISD\Adjustments\Snapshots\data.sn p", "Approved; Rejected", 2,
True
End Sub

Function fctnOutlook(Optional FromAddr, Optional Addr, Optional CC, Optional
BCC, _
Optional Subject, Optional MessageText, Optional Categories, Optional
AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

'Set StrCC = [Form]![e_mailAddress]
'Set ActiveControl = e_mailAddress
'Me.ActiveControl = e_mailAddress
'Set olCC = [Approver].Form![e-mailAddress]
'Set olCC = [Approver].Form![e-mailAddress]

With objOutlookMsg
If Not IsMissing(FromAddr) Then
.SentOnBehalfOfName = FromAddr
End If

If Not IsMissing(Addr) Then
Set objOutlookRecip = .Recipients.Add(Addr)
objOutlookRecip.Type = olTo
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC

End If

If Not IsMissing(BCC) Then
Set objOutlookRecip = .Recipients.Add(BCC)
objOutlookRecip.Type = olBCC
End If

If Not IsMissing(Subject) Then
.Subject = Subject
End If

If Not IsMissing(MessageText) Then
.Body = MessageText
End If

If Not IsMissing(Categories) Then
.Categories = Categories
End If

If Not IsMissing(AttachmentPath) Then
'Check file exists before attaching!
If Len(Dir(AttachmentPath)) 0 Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
Else
MsgBox "Attachment not found.", vbExclamation
End If
End If

If IsNull(Vote) = False Then
.VotingOptions = Vote
End If

Select Case Urgency
Case 2
.Importance = olImportanceHigh
Case 0
.Importance = olImportanceLow
Case Else
.Importance = olImportanceNormal
End Select

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

If EditMessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing

End Function

need to specify form link for field in form for cc option
[Approver].Form![e-mailAddress] anyone have any ideas.

  #3  
Old January 29th 08, 05:49 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Outlook Function help



Look at the form and how the control is named. The naming convention
(record![field]) is for SQL. For forms you would write Form.Fieldname.

--
Best regards
Michael Bauer - MVP Outlook
Synchronize Outlook Categories:
http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6

Am Mon, 28 Jan 2008 11:22:13 -0800 schrieb JC:

Help new at functions-
Have
.Form![e-mailAddress], "Medco Finance Contracts Admin", "Manual Billing
Request. Adjustment Form", "Please review the attached document, Approve

or
Reject by Email. Please email Medco Finance Contracts Admin the revised
Form." & Chr(10) & Chr(10) & "Thank you!" & Chr(10) & Chr(10) &

"Adjustment
Administrator" & Chr(10) & Chr(10), "Billing Request Adjustment",
"S:\Finance\FISD\Adjustments\Snapshots\data.sn p", "Approved; Rejected", 2,
True
End Sub

Function fctnOutlook(Optional FromAddr, Optional Addr, Optional CC,

Optional
BCC, _
Optional Subject, Optional MessageText, Optional Categories, Optional
AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

'Set StrCC = [Form]![e_mailAddress]
'Set ActiveControl = e_mailAddress
'Me.ActiveControl = e_mailAddress
'Set olCC = [Approver].Form![e-mailAddress]
'Set olCC = [Approver].Form![e-mailAddress]

With objOutlookMsg
If Not IsMissing(FromAddr) Then
.SentOnBehalfOfName = FromAddr
End If

If Not IsMissing(Addr) Then
Set objOutlookRecip = .Recipients.Add(Addr)
objOutlookRecip.Type = olTo
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC

End If

If Not IsMissing(BCC) Then
Set objOutlookRecip = .Recipients.Add(BCC)
objOutlookRecip.Type = olBCC
End If

If Not IsMissing(Subject) Then
.Subject = Subject
End If

If Not IsMissing(MessageText) Then
.Body = MessageText
End If

If Not IsMissing(Categories) Then
.Categories = Categories
End If

If Not IsMissing(AttachmentPath) Then
'Check file exists before attaching!
If Len(Dir(AttachmentPath)) 0 Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
Else
MsgBox "Attachment not found.", vbExclamation
End If
End If

If IsNull(Vote) = False Then
.VotingOptions = Vote
End If

Select Case Urgency
Case 2
.Importance = olImportanceHigh
Case 0
.Importance = olImportanceLow
Case Else
.Importance = olImportanceNormal
End Select

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

If EditMessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing

End Function

need to specify form link for field in form for cc option
[Approver].Form![e-mailAddress] anyone have any ideas.

  #4  
Old January 29th 08, 05:57 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Outlook Function help



That mess is really hard to read. The first four arguments for the function
a
- FromAdr
- Addr
- CC
- BCC

Now look at how you're calling the function; you pass:
- Empty
- e_mailAddress
- e_mailAddress (again)
- "Medco Finance..." (that's no address at all, so you can't add that to the
recipients object)

If you'd work with variables instead of passing all the text in one line you
(and others) could read your code easier.

--
Best regards
Michael Bauer - MVP Outlook
Synchronize Outlook Categories:
http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6

Am Mon, 28 Jan 2008 11:37:01 -0800 schrieb JC:

Changed code to and I now can generate one e-mail address code for outlook

;
fails
for multiple recipiets
Private Sub CmdSendEmail_Click()
fctnOutlook , Me.e_mailAddress, Me.e_mailAddress, "Medco Finance Contracts
Admin", "Manual Billing Request. Adjustment Form", "Please review the
attached document, Approve or Reject by Email. Please email Medco Finance
Contracts Admin the revised Form." & Chr(10) & Chr(10) & "Thank you!" &
Chr(10) & Chr(10) & "Adjustment Administrator" & Chr(10) & Chr(10),

"Billing
Request Adjustment", "S:\Finance\FISD\Adjustments\Snapshots\data.sn p",
"Approved; Rejected", 2, True
End Sub

Function fctnOutlook(Optional FromAddr, Optional Addr, Optional CC,

Optional
BCC, _
Optional Subject, Optional MessageText, Optional Categories, Optional
AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim STRcc As String


Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

'Set StrCC = [Form]![e_mailAddress]
'Set ActiveControl = e_mailAddress
'Me.ActiveControl = e_mailAddress
'Set olCC = [Approver].Form![e-mailAddress]
'Set olCC = Me.e_mailAddress
STRcc = Me.e_mailAddress


"JC" wrote:

Help new at functions-
Have
.Form![e-mailAddress], "xxxx", "Manual Billing
Request. Adjustment Form", "Please review the attached document, Approve

or
Reject by Email. Please email xxxx Admin the revised
Form." & Chr(10) & Chr(10) & "Thank you!" & Chr(10) & Chr(10) &

"Adjustment
Administrator" & Chr(10) & Chr(10), "Billing Request Adjustment",
"S:\Finance\FISD\Adjustments\Snapshots\data.sn p", "Approved; Rejected",

2,
True
End Sub

Function fctnOutlook(Optional FromAddr, Optional Addr, Optional CC,

Optional
BCC, _
Optional Subject, Optional MessageText, Optional Categories, Optional
AttachmentPath, Optional Vote As String = vbNullString, _
Optional Urgency As Byte = 1, Optional EditMessage As Boolean = True)


Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

'Set StrCC = [Form]![e_mailAddress]
'Set ActiveControl = e_mailAddress
'Me.ActiveControl = e_mailAddress
'Set olCC = [Approver].Form![e-mailAddress]
'Set olCC = [Approver].Form![e-mailAddress]

With objOutlookMsg
If Not IsMissing(FromAddr) Then
.SentOnBehalfOfName = FromAddr
End If

If Not IsMissing(Addr) Then
Set objOutlookRecip = .Recipients.Add(Addr)
objOutlookRecip.Type = olTo
End If

If Not IsMissing(CC) Then
Set objOutlookRecip = .Recipients.Add(CC)
objOutlookRecip.Type = olCC

End If

If Not IsMissing(BCC) Then
Set objOutlookRecip = .Recipients.Add(BCC)
objOutlookRecip.Type = olBCC
End If

If Not IsMissing(Subject) Then
.Subject = Subject
End If

If Not IsMissing(MessageText) Then
.Body = MessageText
End If

If Not IsMissing(Categories) Then
.Categories = Categories
End If

If Not IsMissing(AttachmentPath) Then
'Check file exists before attaching!
If Len(Dir(AttachmentPath)) 0 Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
Else
MsgBox "Attachment not found.", vbExclamation
End If
End If

If IsNull(Vote) = False Then
.VotingOptions = Vote
End If

Select Case Urgency
Case 2
.Importance = olImportanceHigh
Case 0
.Importance = olImportanceLow
Case Else
.Importance = olImportanceNormal
End Select

For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next

If EditMessage Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing

End Function

need to specify form link for field in form for cc option
[Approver].Form![e-mailAddress] anyone have any ideas.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook Search Function Paul[_4_] Outlook - General Queries 1 August 29th 07 05:00 AM
Outlook calendar function Richard Outlook - Calandaring 2 January 20th 07 10:48 PM
Send From function in Outlook 2003 cruwyser Outlook - General Queries 1 May 24th 06 01:52 PM
Outlook 2003 Import Function pwoodbba Outlook - Using Contacts 1 April 7th 06 10:22 AM
Keyboard function in outlook express richard p litter Outlook Express 2 March 13th 06 07:29 AM


All times are GMT +1. The time now is 03:02 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.