+ Reply to Thread
Results 1 to 2 of 2

Macro to Print to PDF and attach to email

  1. #1
    Registered User
    Join Date
    03-03-2020
    Location
    UK
    MS-Off Ver
    MS Office 365 Pro Plus
    Posts
    1

    Macro to Print to PDF and attach to email

    Hi,

    I need help please. I have inherited a spreadsheet to calculate commissions and print statements to PDF, attaching the statements to an email in drafts. Having made a lot of changes to the excel model, predictably the macro no longer works. I am trying to understand the macro so I can find out where it is falling down. When I run the macro I get no error message. As far as I can tell it works up to the Loop.

    The first bit I don't understand is this bit - If Cells(rCell.Row, Range("rngHeaderEnabled").Column).Value = "yes" Then

    I assume it's using cells function to reference a specific cell using the column of the named range which is fine, this is column KR but I don't understand how it's working out the correct row to start on?

    Thanks in advance, apologies if I've made any forum faux pas, first time posting and I have very limited VBA experience!


    Full Macro below
    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 03-03-2020 at 02:29 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,705

    Re: Macro to Print to PDF and attach to email

    The line of code you mentioned is in a loop that goes through every cell in rRoster. Each time through a loop rCell is set to the next cell in the range rRoster. rCell.Row gives the row that cell is in. So for every cell in the roster, it checks to see if column KR is "yes" on the same row.

    However, there is nothing we can to explain why the code no longer works without seeing your file. See the yellow banner at the top of the page.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. print userform to pdf and then attach it to an email
    By homerjones_45 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-08-2017, 10:47 PM
  2. attach different worksheet and email them tdifferent email address through macro/vba/addin
    By arunverma004 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2014, 08:20 AM
  3. Replies: 0
    Last Post: 09-12-2014, 04:12 PM
  4. [SOLVED] Email Macro to attach a non active worksheet to outlook email
    By mickgibbons1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-21-2013, 08:38 PM
  5. Excel Email Macro - HELP! - Need to be able to attach two different files
    By benwahchang in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-29-2013, 08:41 AM
  6. SaveAs PDF and attach to email macro won't attach?!
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2012, 05:28 PM
  7. Email Macro - Attach Only 1 Tab
    By Moe in forum Excel General
    Replies: 2
    Last Post: 09-04-2007, 11:35 AM

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