Problem running script in MS Office 2007

Hello EE,

I am unable to get Office to run my script properly.  I'm very new to this, so perhaps it is an easy solution.

I want Outlook to send an incoming email's subject line, from, and timestamp to my phone.  I don't have a smartphone but would like to receive new message alerts via text.

I did some browsing on EE and came across code written by: TheGorby

I paste it into VB (Alt+F11) directly in "ThisOutlookSession".  I save it, close Outlook then I create a rule.  The rule has "no conditions" and an action "run a script".
It says: "run Project1.ThisOutlookSession.NewSMS"

I'm not recieving a text. What am I doing wrong/missing?  Thank you.

***code by TheGorby*** (not included in code)

Sub NewSMS(Msg As MailItem)
    Dim strID As String
    Dim strSubj As String
    Dim objMsg As Outlook.MailItem
    If Weekday(Date) = vbTuesday Then
        strID = Msg.EntryID
        Set olkMsg = Application.Session.GetItemFromID(strID)
        strSubj = olkMsg.Subject
        Set olkMsg = Application.CreateItem(olMailItem)
        With olkMsg
            .To = ""
            .Body = strSubj
            .Subject = ""
        End With
    End If
    Set olkMsg = Nothing

End Sub

***code by TheGorby*** (not included in code)

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dangermoundAuthor Commented:
I don't even care about the message info. A text that simply reads, "New Message" would be optimum.
Chris BottomleySoftware Quality Lead EngineerCommented:
In the VB editor of outlook insert | MOdule

Now move your sub to this module and check the rule is updated ... then retry.

>>>I'm not recieving a text. What am I doing wrong/missing?  Thank you.

Tha code will work from "ThisOutlookSession" :)

I believe your macros are disabled :)

To enable macros, From Outlook window, Click on Tools ~~> Macro ~~> Security. Toy will be presented with "Trust Center" Dialog box. Select "No Security check for macros"

See snapshot.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dangermoundAuthor Commented:
That was it. Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.