![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]() 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
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
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 |