Rocky Smolin at Beach Access Software
rockysmolin at bchacc.com
Fri Apr 27 10:39:40 CDT 2007
Max:
That would work EXCEPT. The problem is not part of an Access app. I've got
some code like that and it works real good.
But she wants to create, reply and/or forward emails in Outlook and have the
Bcc automagically add when creating, forwarding, or replying. And she wants
to see it before the mail is sent so she can delete the Bcc is it's not
appropriate. Right now she's adding her assistant's email as a Bcc to about
80% of the messages she sends.
TIA
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gmail
Sent: Friday, April 27, 2007 7:50 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] OT: Default BCC
Hi Rocky
Try messing around with this. I think I have used this function before.
No error handling in example
Max
Public Function pfSendEmail()
Dim dbs As DAO.Database, rst As DAO.Recordset
Dim strSubject As String
Dim strText As String, bDisplayMsg As Boolean
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("QE_ActiveEmails")
If rst.EOF Then
GoTo exithere
Else
bDisplayMsg = False 'True
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
strSubject = "Newsletter"
strText = "Dear Supporter," & vbCrLf & _
"Please note that the latest version of our Newsletters is now available
on our main website at ....etc, etc"
Call fStartClickYes(True)
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
'Always send to MGX (dummy which is valid) ,and BC to recipient to
prevent users seeing each others mail
' Add the To recipient(s) to the message.
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add("mgx at abcdef.org")
objOutlookRecip.Type = olTo
' Set the Subject, Body, and Importance of the message.
.Subject = strSubject
.Body = strText & vbCrLf & vbCrLf
'.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
'If Not IsMissing(AttachmentPath) Then
' Set objOutlookAttach = .Attachments.Add(AttachmentPath)
'End If
' Resolve each Recipient's name.
'For Each objOutlookRecip In .Recipients
' objOutlookRecip.Resolve
'Next
rst.MoveFirst
Do While Not rst.EOF
If Len(rst!EmailUsed) > 0 and InStr(rst!EmailUsed, "@") > 0 Then
' Add the CC recipient(s) to the message.
'Set objOutlookRecip = .Recipients.Add("Name of person")
'objOutlookRecip.Type = olCC
' Add the BCC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(rst!EmailUsed)
objOutlookRecip.Type = olBCC
End If
DoEvents ' give user time to cancel
rst.MoveNext
Loop
' add myself in as a BCC to see what it looks like. should not see
anybody else's BCC address
Set objOutlookRecip = .Recipients.Add("me at myemailaddress.org")
objOutlookRecip.Type = olBCC
' Should we display the message before sending?
If bDisplayMsg Then
.Display
Else
.Save
.Send
End If
End With
Call fStartClickYes(False)
End If
exithere:
'MsgBox "Done"
Set objOutlook = Nothing: Set dbs = Nothing: Set rst = Nothing
Exit Function
End Function
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Friday, April 27, 2007 2:54 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] OT: Default BCC
Max:
Then where would I reference outlook.application in the code? Or is the Dim
all that's necessary? Wouldn't I need a Set statement as well and then a
reference to it in the doe?
TIA
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gmail
Sent: Friday, April 27, 2007 6:34 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] OT: Default BCC
You could try:-
Dim objMe As Outlook.Recipient instead of just Recipient.
I always do things like Dim objOutlook as outlook.application, etc.
Expressly state what the object is.
Max
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Friday, April 27, 2007 2:08 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] OT: Default BCC
Dear List:
The code below is not being run when I send an email. The message I send is
being delivered but not the Bcc. I inserted a MsgBox at the head of the
code just to see if it would show up and it didn't. Does anyone see why
it's not running that code when an email is sent? I'm running OL 2003.
MTIA,
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Tuesday, April 24, 2007 11:48 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] OT: Default BCC
Making progress. The project window wasn't displayed by default. But I
found how to display it, double-clicked ThisOutlookSession, and pasted into
the code window:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objMe As Recipient
Set objMe = Item.Recipients.Add("bchacc at san.rr.com")
objMe.Type = olBCC
objMe.Resolve
Set objMe = Nothing
End Sub
However, it's not sending a Bcc to bchacc at san.rr.com.
Have I missed a step?
TIA
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka
Sent: Tuesday, April 24, 2007 8:21 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] OT: Default BCC
On the left, you should have a project window, a tree representation of your
Outlook VBA project. Top item should be Project1, with Microsoft Outlook as
a child, in turn ThisOutlookSession will be a child of that.
Double click that to bring up it's code page.
Drew
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Tuesday, April 24, 2007 9:49 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] OT: Default BCC
" go into the code window," using Alt-F11?
"there is a 'ThisOutlookSession' object." I don't see that. The left combo
box has only (General) in it. Where would I look for it?
TIA
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka
Sent: Monday, April 23, 2007 4:58 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] OT: Default BCC
When you go into the code window, there is a 'ThisOutlookSession'
object.
Click that, and you should get a blank code page. Click the left drop down
box in the code page and select Application. The right drop down will then
have the ItemSend event.
Drew
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Monday, April 23, 2007 6:03 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] OT: Default BCC
Marty:
You know I found that site. And the code makes sense. But I've never put
any code behind Outlook. Don't know how to get that code attached to the
Item_Send event (if there is such a thing). Any hints on how to?
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of MartyConnelly
Sent: Monday, April 23, 2007 2:59 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] OT: Default BCC
This site says you have to do through VBA code.
or use third party add-in
http://www.howto-outlook.com/faq/createbccrule.htm
To automatically Bcc all outgoing messages.
http://www.outlookcode.com/d/code/autobcc.htm
Rocky Smolin at Beach Access Software wrote:
>Yes, but she has to insert her AA's email address manually on every
>email that goes to a client that she wants to copy the AA on. So she
>was looking for a way to have the AA's email automatically entered in
>the Bcc line on every email.
>
>Rocky
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Andy Lacey
>Sent: Monday, April 23, 2007 10:54 AM
>To: 'Access Developers discussion and problem solving'
>Subject: Re: [AccessD] OT: Default BCC
>
>Sorry if this is too simplistic, but she does have the View BCC option
>ticked doesn't she?
>
>-- Andy Lacey
>http://www.minstersystems.co.uk
>
>
>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky
>>Smolin at Beach Access Software
>>Sent: 23 April 2007 17:51
>>To: 'Access Developers discussion and problem solving'
>>Subject: Re: [AccessD] OT: Default BCC
>>
>>
>>Almost there. The user who asked me for this wants to Bcc.
>>The rule wizard
>>seems to only allow CC. It's a law office and this person
>>wants to Bcc her
>>admin assistant. Is there a way to do Bcc?
>>
>>Rocky
>>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka
>>Sent: Monday, April 23, 2007 9:39 AM
>>To: Access Developers discussion and problem solving
>>Subject: Re: [AccessD] OT: Default BCC
>>
>>Okay, step by step using Outlook 2003.
>>
>>Click Tools --> Rules and Alerts
>>
>>Click New Rule
>>
>>Select 'Start from a blank rule' (not default selection)
>>
>>Under Step1, select Check messages after sending, click next.
>>
>>Click next again (you will be prompted again, click Yes)
>>
>>(Side note, this rule now applies to ALL email you send. The last
>>Next and Yes skipped past conditions you may want to choose)
>>
>>Select 'CC the message to people or distribution list'.
>>
>>In the step 2 window, click the underlines 'people or distribution
>>list' to select the address you want the copy sent too.
>>
>>Click Next, then Next again (this one skips the exceptions that you
>>can apply to your rule)
>>
>>Click Finish
>>
>>All done!
>>
>>Drew
>>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin
>>at Beach Access Software
>>Sent: Monday, April 23, 2007 11:02 AM
>>To: 'Access Developers discussion and problem solving'
>>Subject: Re: [AccessD] OT: Default BCC
>>
>>
>>That WOULD be easy. But I don't see a rule that governs outgoing
>>addresses. Only sorting incoming mail. Am I missing it somewhere?
>>
>>Rocky
>>
>>
>>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka
>>Sent: Monday, April 23, 2007 8:11 AM
>>To: Access Developers discussion and problem solving
>>Subject: Re: [AccessD] OT: Default BCC
>>
>>Probably easier to use a rule. (There's a rule wizard to help out).
>>
>>Drew
>>
>>-----Original Message-----
>>From: accessd-bounces at databaseadvisors.com
>>[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Rocky Smolin
>>at Beach Access Software
>>Sent: Sunday, April 22, 2007 2:45 PM
>>To: 'Access Developers discussion and problem solving'
>>Subject: [AccessD] OT: Default BCC
>>
>>
>>
>>
>>Dear List:
>>
>>Is there a way to default an email address into the BCC field in
>>Outlook when you create a new message?
>>
>>TIA
>>
>>Rocky
>>
>>
--
Marty Connelly
Victoria, B.C.
Canada
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.5.9/773 - Release Date: 4/22/2007
8:18 PM
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.5.9/773 - Release Date: 4/22/2007
8:18 PM
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.5.10/774 - Release Date: 4/23/2007
5:26 PM
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.5.10/774 - Release Date: 4/23/2007
5:26 PM
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.6.1/777 - Release Date: 4/26/2007
3:23 PM
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.6.1/777 - Release Date: 4/26/2007
3:23 PM