Email attachments recorded in Excel -


the macro below designed take x amount of emails, count how many attachments there in each mail , locate file formats. record has found in excel spreadsheet.

the macro works perfectly, wanting add in scenario. scenario want add in of if email has more 1 .csv file, shall recorded "multiple" rather "yes".

has got ideas implement scenario?

        if .attachments.count = 0         csv_report = "no"         pdf_report = "no"         xls_report = "no"         end if          if .attachments.count > 0         i2 = 1 .attachments.count         if lcase(right(.attachments(i2).filename, 4)) = ".csv"         csv_report = "yes"         goto csvyes        'if .csv file found, skips pdf attachment checker         else         csv_report = "no"         end if         next  csvyes:         i2 = 1 .attachments.count         if lcase(right(.attachments(i2).filename, 4)) = ".pdf"         pdf_report = "yes"         goto pdfyes        'if .pdf file found, skips xls attachment checker         else         pdf_report = "no"         end if         next  pdfyes:         i2 = 1 .attachments.count         if lcase(right(.attachments(i2).filename, 4)) = ".xls" or lcase(right(.attachments(i2).filename, 5)) = ".xlsx" or ucase(right(.attachments(i2).filename, 4)) = ".xls"         xls_report = "yes"         goto xlsyes        'if .xls file found, skips end of checks         else         xls_report = "no"         end if         next  xlsyes:         end if          sheets("mail report").activate         range("c65000").end(xlup).offset(1).value = csv_report         range("d65000").end(xlup).offset(1).value = pdf_report         range("e65000").end(xlup).offset(1).value = xls_report          subject_line = mail.subject         range("a65000").end(xlup).offset(1).value = subject_line 

check below code. have added if else block check if attachment.count > 1. that's it.

if .attachments.count > 0     i2 = 1 .attachments.count     if lcase(right(.attachments(i2).filename, 4)) = ".csv"     if .attachments.count > 1        csv_report = "multiple"     else        csv_report = "yes"     end if     goto csvyes        'if .csv file found, skips pdf attachment checker     else     csv_report = "no"     end if     next 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -