please see below message with attachment
thanks for looking
please see below message with attachment
thanks for looking
Last edited by lapot; 02-22-2016 at 08:43 AM.
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
Last edited by lapot; 02-22-2016 at 08:43 AM.
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
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?
Thanks![]()
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
Last edited by lapot; 04-11-2016 at 08:36 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks