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
http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_26704826.html

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 = "5555551212@txt.att.net"
            .Body = strSubj
            .Subject = ""
            .Send
        End With
    End If
    
    Set olkMsg = Nothing

End Sub

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

Open in new window

dangermoundAsked:
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.
0
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.

Chris
0
SiddharthRoutCommented:
>>>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 :)

Sid
0
SiddharthRoutCommented:
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.

Sid
Untitled.jpg
0

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!
0
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
Outlook

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.