-
Mar 6th, 2003, 06:20 PM
#1
Thread Starter
Registered User
MS Outlook VBA Snippet - Sending calendar reminder from MS Outlook to a Pager
Hey guys,
I am posting this also on this message board.
I first put it in the General VB Section.
First off, I still consider myself very much a beginner at VB, so please bear with me...
The code I am posting here is used to send a REMINDER of a CALENDAR EVENT in MS Outlook.
The code is placed inside MS Outlook, and MS Outlook must be running for this code to work.
I have tested this in Outlook 2000 runing on Windows 2000.
I have not tested it in Outlook 2002 (xp), or older versions such as Outlook 98 or 97. (I believe that outlook 98 & 97 do not have this problem)
I have been searching high and wide and trying to figure out how to send a page through ms outlook 2000..
I use to use it and it worked nicely, but our company installed the SR1 for Outlook 2000 which has the security patch, it no longer works.
When you try and have some code in outlook that sends the email to the pager, outlook pops up that ever famous window stating that "another program is trying to access outlook..." blah blah blah.
Anyway, I am posting this here because I found pieces of the solution everywhere, but not the entire solution in one place.
So, here it is in one place.
To get around the security problem built into the new releases of MS Outlook, I downloaded and installed the .dll COM Addin available for free at :
http://www.dimastr.com/redemption
here is the link to download their file:
http://www.dimastr.com/redemption/Redemption.zip
This .dll file is the key to this whole program working.
Here is a brief explanation of what their .dll COM Addin does:
"Outlook Redemption works around limitations imposed by the Outlook Security Patch and Service Pack 2 of MS Office 2000 and Office XP (which includes Security Patch)."
So, download their .dll COM Addin and put it in your system directory such as C:\WINNT\SYSTEM32\
The dll file is named:
redemption.dll
To install it, First, make sure MS Outlook is CLOSED.
Then in Windows, just click on the Start Button, and click on RUN and
then put in this command..
regsvr32.exe redemption.dll
and click on the ‘OK’ button.
A box comes up with licensing agreement.. click past it and it's installed.
Ok, I work at a very big corporation. I am actually a senior PC Tech and we use MS Outlook 2000 with Exchange Server (version 5 I believe).
So, to send an email from outlook manually, we are on AIRTOUCH Paging, so the send to address looks like this:
310-555-1212@alphapage.myairmail.com
Also, when you send an email manually from MS Outlook to one of our pagers, it does not pickup the subject line, so, I put the subject, time of the appointment and body, all in the body of the message.
I formatted the time to vbLongTime because I just liked that format. If you like a 23 hour clock, you could format it to vbShortTime.
Paste the code into MS Outlook “This Outlook Session” by doing the following:
In MS Outlook, click on /Tools/Macro/Visual Basic Editor/
It opens a window with a folder named “Project1” on the left hand side.
Expand this folder by clicking on the + sign.
Double Click on the line that says “ThisOutlookSession”
It opens up a code window on the left side of the screen.
Paste the code in this window.
Adjust the setting in the line sendto = 310-389-6604@alphapage.myairmail.com , by putting in
Your own pager number settings, that is the email address you use to send mail to your pager.
Click on /File/SaveVbaProject.OTM
Exit the Visual Basic Editor.
I then set my security for macros to low, I don't know if this was necessary, but I did it.
To set your security for macros in MS Outlook to medium or low,
Click on Tools/Macro/Security
Select Medium or Low and click on the 'OK' button.
At this point I actually shut down MS Outlook and the restart it.
You can now test it by opening your calendar and setting an appointment.
NOTE: You must have the ‘Reminder’ box checked or it will not send anything to your pager.
Because, that is what this code does…, it sends a reminder of a calendared event in advance of the event, to your pager.
Uncheck the ‘All Day Event’ box and fill in the time for the appointment to start and end.
You can put in a Subject line, a Location line, and then type a longer message in the Main Body of the event.
It will all be sent with the time to your pager.
I hope this is enough explanation.
Here is the code……. ( I didn't really write it guys, i just got it from a few sources and put it together until it worked....)
'---------------------------------------------------------
VB Code:
Private Sub Application_Reminder(ByVal Item As Object)
If TypeOf Item Is AppointmentItem Then SendApptReminder Item
End Sub
Private Sub SendApptReminder(ByRef Item As AppointmentItem)
SendPage "Subject: " & Item.Subject & vbCrLf, "Time: " & FormatDateTime(Item.Start, vbLongTime) & "-" & FormatDateTime(Item.End, vbLongTime) & vbCrLf & "Location: " & Item.Location & vbCrLf & Item.Body
End Sub
Private Sub SendPage(ByRef Subject As String, ByRef Body As String)
Dim sendto As String
Dim SafeItem, oItem
sendto = "310-555-1212@alphapage.myairmail.com" '---put the email address of your pager here
Set SafeItem = CreateObject("Redemption.SafeMailItem") '--Create an instance of Redemption.SafeMailItem
Set oItem = Application.CreateItem(0) '---Create a new message
SafeItem.Item = oItem '--set Item property
SafeItem.Recipients.Add sendto
SafeItem.Recipients.ResolveAll
SafeItem.Body = Subject & " " & Body '--my paging system only sends the body, so i put the subject and body together
SafeItem.Send
End Sub
'--------------------------------------------------
Kevin Rea
krea@socal.rr.com
Last edited by krea; Mar 6th, 2003 at 09:24 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|