Forum

Create, email, and ...
 
Notifications
Clear all

Create, email, and file PDF for specific worksheets

17 Posts
4 Users
0 Reactions
416 Views
(@catalinb)
Posts: 1937
Member Admin
 

Hi Laura,

welcome to our forum.

You can put that code in a new module, or in the same module where the create_and_email_pdf procedure is located.

That module should look like:

Sub SendAllSheets()

Dim ws As Worksheet
  
     For Each ws In ThisWorkbook.Worksheets
      
        ws.Activate
      
        if ActiveSheet.Cells(1,"E").Value  Like "*@*" Then create_and_email_pdf
  
     Next

End Sub

 

Sub create_and_email_pdf()

....code to send pdf

End Sub

 

The code you mentioned should work, if that email address is in cell E1 of each sheet. Of course, you can change from ActiveSheet.Cells(1,"E") to any cell you like, to cell V6 for example: ActiveSheet.Cells(6,"V")

The code will loop through each sheet, will activate it, and if there is an email address in the target cell, will send that sheet.

 
Posted : 11/09/2019 8:29 am
(@mwood)
Posts: 1
New Member
 

Hello -  I am new to myonlinetraining hub and new to this forum.  the VBA provided above is AWESOME and I really appreciate it so much.  I am very close to getting it work the way I need it to (similar to others - have a workbook with several sheets, each sheet needs to be saved as a PDF and emailed to the recipient, different recipient email for each sheet).    the issue I am running into is that the macro asks me for EVERY sheet to specify the folder location to save the PDF in.  I don't want to have to tell it 35 times the same folder location.  how do I get it to stop doing this, and just be able to tell it one time the folder location?

Thank you in advance SO MUCH!!!  this forum is great and I have learned so much already!

 

Michelle W.

 
Posted : 15/11/2019 2:36 pm
Page 2 / 2
Share: