+ Reply to Thread
Results 1 to 6 of 6

Code Issue - PDF to Email

  1. #1
    Registered User
    Join Date
    01-06-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010, Excel 365
    Posts
    47

    Code Issue - PDF to Email

    I use the below code to convert a sheet into a PDF then attach it to an email with the To and Subject lines filled out. It's not working for a coworker and the debugger is highlighting the code line that I put dashes after. Anyone have any ideas or a solution? Thank-you in advance for any help!

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,961

    Re: Code Issue - PDF to Email

    .
    I'm curious how the code is working for you. Tried it on my system here ... nothing. Marked out all the error checking comments
    and no error messages either. Strange.

    In any case, here is another method to accomplish what you want :

    Please Login or Register  to view this content.
    The code as written will also copy the email addresses where they are presently located (L2:L5). You can move the email addresses to rows that are not
    aligned with the existing data rows and then the email addresses won't show in the PDF. The addresses can be placed on another sheet or the same
    sheet at present but somewhere lower down than Row 18.

    As indicated ... this is just one method of accomplishing your goal. There are plenty of other variations as well.
    Attached Files Attached Files
    Last edited by Logit; 05-02-2019 at 10:30 PM.

  3. #3
    Registered User
    Join Date
    01-06-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010, Excel 365
    Posts
    47

    Re: Code Issue - PDF to Email

    My original code works great with my computer. Are you running an older Windows OS?
    I made some adjustments to your code and it worked on my computer (OneDrive does not sync my desktop). I sent it to the person that was having issues and they got an error (OneDrive does sync his desktop). The debugger brought him to the "MkDir myFolder" line (I marked it with dashes below). I think that's happening because the path to the desktop changes to the OneDrive desktop path. That's why my code had an On Error GoTo option in it.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    6,961

    Re: Code Issue - PDF to Email

    .
    If I correctly understand the error you are experiencing, follow the instruction below :

    Please Login or Register  to view this content.
    And, where ever the terms : "\Desktop\PDFs" : are also located through out the macro, you will need to edit those as well.

  5. #5
    Registered User
    Join Date
    01-06-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010, Excel 365
    Posts
    47

    Re: Code Issue - PDF to Email

    I have a mixture of users - some that have OneDrive syncing their desktops and some that don't. That's why I have the "EOneDrive" portion of the code. If the first part comes back with an error, then it goes to the EOneDrive code. Separately, the codes work fine, but when I put them together, like I have them in my original code, we get an error on the "OutlApp.Visible = True" code line under the EOneDrive portion.

  6. #6
    Registered User
    Join Date
    01-06-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010, Excel 365
    Posts
    47

    Re: Code Issue - PDF to Email

    I got my original code to work now... I just removed the line that came up on the error.

+ 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. Replies: 1
    Last Post: 05-13-2018, 08:23 PM
  2. [SOLVED] VBA Code to email multiple people and code to go to the next email if error occurs
    By pmeltzers in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2018, 12:31 PM
  3. VBA Code to Auto intialsend email & reminder email based on cell value
    By swk8429 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-16-2015, 06:15 AM
  4. Sending Email from VBA - selecting correct email address issue
    By Rachieo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2014, 03:51 PM
  5. VBA code to send email to the people whose email address is in the Access table
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2014, 05:11 AM
  6. [SOLVED] how to make range of cell A14:q14 and cell selected in to email vba code issue
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-23-2013, 12:06 PM
  7. Excel code to email whats in the spreadsheet in the body of email
    By Kain93 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-18-2012, 09:55 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