+ Reply to Thread
Results 1 to 4 of 4

Emailing whole hyperlink range in one email.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-29-2006
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    314

    Emailing whole hyperlink range in one email.

    please see below message with attachment

    thanks for looking
    Last edited by lapot; 02-22-2016 at 08:43 AM.

  2. #2
    Forum Contributor
    Join Date
    08-29-2006
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    314

    Re: Emailing whole hyperlink range in one email.

    Dear all

    I have hyperlinks for individual invoices on Column F. These links open individual invoices.

    I have a user form and it has TextBox5. I have created a button when I clicked the button the number in the Textbox5 finds invoice no under column E , activates the hyperlink under Column F relating to that invoice number then converts found invoice in to PDF format and attaches the invoice on an email.

    what I like to do is changing below code and attaches whatever link we have under Colum F on to an email.

    I m sure it is easy just change a few things below code and get the result. I have tried a few things it didn't worked for me.

    Can you please help?

    Regards

    Set R = Worksheets("invoice").Range("E2", _
    Worksheets("invoice").Range("E" & Rows.Count).End(xlUp))
    With R
            .NumberFormat = "0"
            .Value = .Value
            Set fnd = .Find(TextBox5.Value, LookAt:=xlWhole)
    End With
         If Not fnd Is Nothing Then
            Unload Me
            fn = fnd.Offset(, 1).Value
            fnPDF = TempPDF(fn)
            MakeWordPDFFile fn, fnPDF
        
    Else: MsgBox "Number not found!"
    End If
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    On Error Resume Next
    Ref1 = TextBox5.Value
    strBody = ""
    With OutMail
    .To = ""
    .CC = ""
    .BCC = ""
    .Subject = "Payment Reminder for Invoice No : " & Ref1
    Attached Files Attached Files
    Last edited by lapot; 02-22-2016 at 08:43 AM.

  3. #3
    Forum Contributor
    Join Date
    08-29-2006
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    314

    Re: Emailing whole hyperlink range in one email.

    Hi all again
    Looks like no one will be able to solve my problem on this, I like to approach it differently, is there a way that I can do this by going into the directory and picking the individual invoices regarding the requested invoice number then attaching it as PDF on to one email
    For example ; “ \\SVR-Storage4\Accounts_Data\CM-Docs\B\P\1\BP1\214\Billref 245680_513897_1.docx “ this directory link can be broken down as C:\\SVR-Storage4\AccountsData\CM-Docs\ B is first letter of the client code and P is the second letter of the client code these 2 letter are folders by itself ,1 is the first number of the client code (this can be 2 or 3 numbers sometimes) this is also a folder , when whole of these folders selected it gives you another folder BP1 which contains the various matters under this client code , on this incident matter folder is 214 where the Bill ref 245680 is stored, the rest of the number is not needed.
    I have seen on some other forums that people managed to attach multiple documents by selecting the directory. Would it be possible to write a code which will pick up the invoice from the directory rather than the document path option (Colum F) as the document path option hasn’t worked?
    Thank you for your time

  4. #4
    Forum Contributor
    Join Date
    08-29-2006
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    314

    Re: Emailing whole hyperlink range in one email.

    Hi All
    Finally I have cracked this problem and managed to attach more one than one file on an email (I didn't know it is this easy), the only problem I have is I had to point the exact cell number that had the path address. Is that a way that I can generalise the cell rather than saying B2,B3,B4,B5 ...ect? I want the macro see every cell path in Colum B until the empty cell and attach it to the email as PDF. Can you please help me on that?
    Sub AttachMultiFiles()
    
    Dim inv As String, invPDF As String
    Dim inv2 As String, inv2PDF As String
    Dim inv3 As String, inv3PDF As String
    
    'S = Stored location
    
    'FOR INVOICE 1
    S = Worksheets("Sheet1").Range("B2").Value
    
    MyFilePath = S
    'PDF convert
    inv = MyFilePath
    invPDF = TempPDF(inv)
    MakeWordPDFFile inv, invPDF
    
    'FOR INVOICE 2
    S = Worksheets("Sheet1").Range("B3").Value
    
    MyFilePath2 = S
    'PDF convert
    inv2 = MyFilePath2
    inv2PDF = TempPDF(inv2)
    MakeWordPDFFile inv2, inv2PDF
    
    'FOR INVOICE 3
    S = Worksheets("Sheet1").Range("B4").Value
    
    MyFilePath3 = S
    'PDF convert
    inv3 = MyFilePath3
    inv3PDF = TempPDF(inv3)
    MakeWordPDFFile inv3, inv3PDF
    
    'Create e-mail item
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    
    With OutMail
    .BodyFormat = olFormatHTML
    .HTMLBody = "Here is the file you asked for"
    .Attachments.Add invPDF
    .Attachments.Add inv2PDF
    .Attachments.Add inv3PDF
    .Display
    End With
    End Sub
    Thanks
    Last edited by lapot; 04-11-2016 at 08:36 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hyperlink mailto: Email that will deliver cell range results
    By karisiasafaris in forum Excel General
    Replies: 14
    Last Post: 05-11-2015, 04:24 PM
  2. Replies: 1
    Last Post: 12-23-2014, 07:39 PM
  3. [SOLVED] Emailing Sheet via Outlook by VBA - Body is Missing from 1st email only
    By DaveBre in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2014, 11:53 PM
  4. Emailing PDF, another attachment, and with range in email body
    By supcussy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2012, 10:03 PM
  5. Replies: 2
    Last Post: 02-10-2011, 04:53 PM
  6. Emailing from nominated email address
    By Andrew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-03-2006, 09:40 PM
  7. Emailing A single worksheet wit a email address
    By Steved in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-10-2005, 07:06 PM

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