Ask Experts Questions for FREE Help !
Ask
    Wonder84lalala's Avatar
    Wonder84lalala Posts: 41, Reputation: 1
    Junior Member
     
    #1

    Aug 28, 2006, 09:58 AM
    Alerting email
    Hi,

    I want to write a small macro in Excel that would send an email when something goes wrong. Can you please help me the VB codes?

    Thanks alots!
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Aug 28, 2006, 10:10 AM
    There are two possibilities here. One possibility would be to use the Hyperlink object with a mailto:[email protected] to generate an e-mail. The other is to use the Route property to send the workbook. Not sure which would be best for you. Lookup Hyperlink and Route in Excel VBA Help.
    Wonder84lalala's Avatar
    Wonder84lalala Posts: 41, Reputation: 1
    Junior Member
     
    #3

    Aug 31, 2006, 05:45 AM
    Hi Scott,

    Thanks for your feedback, but I didn't find any helpful information when I looked into Lookup Hyperlink and Route in Excel VBA Help. Can you show me the examples?

    Thanks!
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #4

    Aug 31, 2006, 06:12 AM
    Gee I found the info when I looked. Though I see the HTML editor stripped out part of my instructions; you need to use the Mailto: tag before the e-mail address.
    Wonder84lalala's Avatar
    Wonder84lalala Posts: 41, Reputation: 1
    Junior Member
     
    #5

    Sep 6, 2006, 06:53 AM
    Hi Scott,

    I am not sure if we are looking at the same Excel VBA Help, can you please copy and paste what you saw.

    Below is what I have found in Excel VBA under Route:

    Example
    This example sends Book1.xls to three recipients, one after another.

    Workbooks("BOOK1.XLS").HasRoutingSlip = True
    With Workbooks("BOOK1.XLS").RoutingSlip
    .Delivery = xlOneAfterAnother
    .Recipients = Array("Adam Bendel", _
    "Jean Selva", "Bernard Gabor")
    .Subject = "Here is BOOK1.XLS"
    .Message = "Here is the workbook. What do you think?"
    End With
    Workbooks("BOOK1.XLS").Route
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #6

    Sep 6, 2006, 06:57 AM
    Yes, That's what I found. That, as I described, is one possibility.
    Wonder84lalala's Avatar
    Wonder84lalala Posts: 41, Reputation: 1
    Junior Member
     
    #7

    Sep 6, 2006, 07:32 AM
    Are the codes correctly? Where can I place them (under workbook or any tabs) Do I have a create a textbox or label?

    Workbooks("BOOK1.XLS").HasRoutingSlip = True
    With Workbooks("BOOK1.XLS").RoutingSlip
    .Mailto: [email protected]
    .Recipients = Array("First Last")
    .Subject = "Here is BOOK1.XLS"
    .Message = "Here is the workbook. What do you think?"
    End With
    Workbooks("BOOK1.XLS").Route
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #8

    Sep 6, 2006, 08:25 AM
    The code would be part of a VBA module that could be triggered from a button or key combination.
    Wonder84lalala's Avatar
    Wonder84lalala Posts: 41, Reputation: 1
    Junior Member
     
    #9

    Sep 7, 2006, 11:06 AM
    Scott,

    I tried to trigger from a buttom, but I got an error, can you please check the error?

    Private Sub CommandButton1_Click()

    ActiveWorkbook.HasRoutingSlip = True
    ActiveWorkbook.RoutingSlip.Mailto: xlOneAfterAnother

    Workbooks("Test.XLS").HasRoutingSlip = True
    With Workbooks("Test.XLS").RoutingSlip
    .Delivery = xlOneAfterAnother
    .Mailto: [email protected]
    .Subject = "Here is Test.XLS"
    .Message = "Here is the workbook. What do you think?"
    End With
    Workbooks("Test.XLS").Route

    End Sub
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #10

    Sep 7, 2006, 11:44 AM
    I said there are TWO ways to do it. One using Mailto and another using Routing. You are trying to combine both things into one. If you look at the code sample it shows using .Recipients for the To box. You changed the code to something else.

    Use one method or the other.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Can't email [ 2 Answers ]

I have an email address from Yahoo. I can receive emails but once I go to send one, when I'm on the page were it asks there email address and subject, but there is no box where I can write my email. It has the subject and their address but below that it has no box to write. But I asked my...

Sent Email [ 7 Answers ]

Is there a way that I can get notification that an email has been read? Thanks

The best email like The Bat! [ 4 Answers ]

Anybody help me find an email client as good as The Bat! I am using The Bat! Email client for years. I love its features, but now a days many of my email reciepient blocks my email because of possible spam from The Bat email client. I still fond of using it. So to cover all of my email...

Email 'Signatures' [ 3 Answers ]

Using Outlook Express 6 with Windows 2000. I want to create an Email signature in one font but to have my main default font message as a different one without having to change either each time I send a new email. I know broadly how that SHOULD be done, but no matter what I try, the...

Yahoo Email [ 2 Answers ]

Each time I try and log in to my Yahoo email account the site starts to load then it says cannot find server. It only does this with Yahoo. Can you please help me out??


View more questions Search