+ Reply to Thread
Results 1 to 9 of 9

Convert to PDF and Email with Gmail

  1. #1
    Registered User
    Join Date
    09-26-2008
    Location
    North Myrtle Beach
    MS-Off Ver
    365 Business
    Posts
    82

    Question Convert to PDF and Email with Gmail

    I have a form (sheet) that has ActiveX control check boxes, dependent drop downs and fill in cells. I have tried the CDO version of converting this and sending as HTML in gmail, however, the activeX controls do not convert nor does the outline formatting. I really want to have VBA script to convert it to a PDF and attach in an email via gmail automatically, but I haven't been able to figure it out. Is it possible? If so, please guide me. If not, would using Form controls work instead? Any other better ideas??

    Below is my current code:

    Please Login or Register  to view this content.
    Thanks for any help!

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Convert to PDF and Email with Gmail

    Please Login or Register  to view this content.
    if i assume the rest of your code actually works
    then you just need to export to pdf and attachment.add said Pdf
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Convert to PDF and Email with Gmail

    if your pdf doesnt output to your liking then just set print area instead of just setting rng

  4. #4
    Registered User
    Join Date
    09-26-2008
    Location
    North Myrtle Beach
    MS-Off Ver
    365 Business
    Posts
    82

    Re: Convert to PDF and Email with Gmail

    Humdingaling,
    Thank you for your help. When I alter my code adding the few lines you put in and changing the HTMLBody to Attachments, it comes an error of object not defined. I have tried defining TempFile as an object and as a string, but when I do that I get an error of "Type mismatch"
    Am I defining it incorrectly?
    Thanks

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Convert to PDF and Email with Gmail

    sorry Tempfile should be a string

    Q; is your tempfile pdf actually being made.

    re: htmlbody
    not sure if you are wanting HTML email or just plain text email
    this link should explain the difference

    https://www.rondebruin.nl/win/s1/cdo.htm

  6. #6
    Registered User
    Join Date
    09-26-2008
    Location
    North Myrtle Beach
    MS-Off Ver
    365 Business
    Posts
    82

    Re: Convert to PDF and Email with Gmail

    I am attaching my file in hopes it will help get to the resolution I need. I prefer the file be attached as a PDF. The PDF does get created, but not sure if the temp file is being created. Ideally I would lke the PDF to auto load into an email within the gmail account and autopopulate the email address it will be mailed to based on the email address in cell G2. If I can't get that to work, I would settle for it to auto-load the pdf created into a google drive associated with the same gmail account.
    Just trying to make it an easy to use file for our non-computer-savy employees. In this temp file I have created, I have deleted all of the other macros I had (Print, clear, etc) to narrow down the issues.
    Thanks again for your help!
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Convert to PDF and Email with Gmail

    sorry my bad

    with CDO
    its .AddAttachment not attachment.add
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-26-2008
    Location
    North Myrtle Beach
    MS-Off Ver
    365 Business
    Posts
    82

    Re: Convert to PDF and Email with Gmail

    I had to make a few more tweeks, but it seems to be working now!
    Thank you so much

  9. #9
    Registered User
    Join Date
    11-29-2021
    Location
    Malaysia
    MS-Off Ver
    2016
    Posts
    1

    Re: Convert to PDF and Email with Gmail

    Can I know what are the tweeks you have done to make it work? I am also currently finding out ways to auto generate the gmail with PDF attachment using excel.

+ 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. Code to send email with table on the email body via gmail
    By ivhee00 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2017, 12:24 AM
  2. [SOLVED] VBA Code to add Gmail signature into email
    By Sintek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2016, 11:00 AM
  3. get a workbook in excel to email out through gmail not outlook
    By emussynski in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-21-2016, 12:19 AM
  4. Email Active Worksheet via Gmail
    By cturpin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2016, 11:53 AM
  5. [SOLVED] Macro to send email via gmail program
    By excelnoob_15 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-13-2016, 06:52 PM
  6. [SOLVED] Button to send an email via Gmail
    By Drayde in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-28-2014, 08:23 AM
  7. compiling gmail email list
    By howwwie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2011, 09:34 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