Re: Outlook Macros
"Michael Sole" <[email protected]>
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Message-ID | <[email protected]> |
Yeah that code I had no luck with, this code actually works now:
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = CreateObject("Outlook.Application")
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
Case Else
' anything else will result in an error, which is
' why we have the error handler above
End Select
Set objApp = Nothing
End Function
Sub ADDASGOOD()
Dim myOutlook As Outlook.Application
Dim myMail As Outlook.MailItem
Dim myAttach As Outlook.MailItem
Set myOutlook = CreateObject("Outlook.Application")
Set myMail = CreateItem(olMailItem)
'Pick email to send as attachment
'Set myAttach =
myOutlook.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items(1)
Set myAttach = GetCurrentItem()
With myMail
.To = " TRAINING EMAIL HERE"
.Subject = "Good Training"
.Body = "TRAINING COMMAND HERE"
'Attach myAttach mailitem
.Attachments.Add myAttach
.Send
End With
'clean up memory
Set myForward = Nothing
Set myMail = Nothing
Set myOutlook = Nothing
End Sub
Sub ADDASSPAM()
Dim myOutlook As Outlook.Application
Dim myMail As Outlook.MailItem
Dim myAttach As Outlook.MailItem
Set myOutlook = CreateObject("Outlook.Application")
Set myMail = CreateItem(olMailItem)
'Pick email to send as attachment
'Set myAttach =
myOutlook.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items(1)
Set myAttach = GetCurrentItem()
With myMail
.To = "TRAINING EMAIL HERE"
.Subject = "Bad Training"
.Body = " TRAINING COMMAND HERE"
'Attach myAttach mailitem
.Attachments.Add myAttach
.Send
End With
myAttach.Delete
'clean up memory
Set myForward = Nothing
Set myMail = Nothing
Set myOutlook = Nothing
End Sub
Again just update the code with the correct email address and training
command and it should do the right thing. Note: I made it delete bad
email.
Michael
-----Original Message-----
From: crm114-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
[mailto:crm114-general-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Paolo
Sent: Thursday, July 10, 2008 10:13 AM
To: [email protected]
Subject: Re: [Crm114-general] Outlook Macros
On Thu, Jul 10, 2008 at 09:52:16AM -0400, Michael Sole wrote:
> sh: test -n : command not found
>
> Actually I just realized this does not forward as an attachment.
Can
> someone help me modify this so it does?
did you check gary's solution posted time ago?
(local copy, likely outdated)
http://crm114.sf.net/coolthings/OutlookHack.txt
check
http://crm114.sourceforge.net/wiki/doku.php?id=coolthings
for hopely updated URL and perhaps other pointers.
--
paolo
------------------------------------------------------------------------
-
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Crm114-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crm114-general
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08