Closed Thread
Results 1 to 3 of 3

Excel VBA Email confirmation on save with hyperlink to workbook

  1. #1
    Registered User
    Join Date
    02-08-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Excel VBA Email confirmation on save with hyperlink to workbook

    I'm a newbie and I'm stuck. I was trying to piece together code from the internet but it's not working. I have an Excel sheet that is shared on a network drive. When it is updated, I need an email sent out that includes a hyperlink back to the sheet that was changed. I tried putting the link in the Excel sheet itself but it appears as text in the email body.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
    Cancel As Boolean)

    'open outlook type stuff
    Set OutlookApp = CreateObject("Outlook.Application")
    Set OlObjects = OutlookApp.GetNamespace("MAPI")
    Set newmsg = OutlookApp.CreateItem(olMailItem)
    'add recipients
    'newmsg.Recipients.Add ("Joe")
    newmsg.Recipients.Add ("[email protected]")
    'add subject
    newmsg.Subject = " Leakage"
    'add body
    newmsg.HTMLBody = Range("A1").Value
    newmsg.Display 'display
    newmsg.Send 'send message
    'give conformation of sent message
    MsgBox " Confirmation email has been sent", , "Confirmation"






    'save the document
    'Me.Worksheets.Save

    End Sub

    Any help is greatly appreciated!

    Tony C

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Excel VBA Email confirmation on save with hyperlink to workbook

    Hi cableguy2004 and welcome to the forum. Unfortunately,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Excel VBA Email confirmation on save with hyperlink to workbook

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1