Send Google Mail From Excel - 3 Different Options

Поділитися
Вставка
  • Опубліковано 27 лис 2024

КОМЕНТАРІ • 16

  • @krn14242
    @krn14242 9 місяців тому +2

    Wow, I think I'll stick to Outlook. Thanks for the video.

  • @albertocollazo9986
    @albertocollazo9986 5 місяців тому

    Could please explain how to add an attachment to gmail when the attachment is defined by a variable and not as hard coded path/filename in VBA. Example .Addattachment "c:\data\testmail.xlsx".
    I'm looking for something along the lines of .Addattachment path & fname & ".pdf" where both the path and fname are variables defined as strings in the macro.
    Thank you in advance for your help

    • @ExcelMacroMania
      @ExcelMacroMania  5 місяців тому

      CDOmail.Attachment "c:\data\testmail.xlsx"

    • @albertocollazo9986
      @albertocollazo9986 5 місяців тому +1

      @@ExcelMacroMania Thank you for your kind and timely answer

  • @mohanedalwhaibi576
    @mohanedalwhaibi576 5 місяців тому

    i am using an app called mail came in windows 11 how can i send through it regards

    • @ExcelMacroMania
      @ExcelMacroMania  5 місяців тому

      I believe Mail in Windows 11 is Outlook as part of Microsoft 365, so you should be able to send an in email from Excel using the method described in the other videos (Send Mail from Excel) or this one if you manage to setup a gmail account there.

  • @marievicibayan54
    @marievicibayan54 3 місяці тому

    Hi hope you see my message. how to add an attachment to Gmail using a hard-coded path/file name in VBA?

    • @ExcelMacroMania
      @ExcelMacroMania  3 місяці тому +1

      CDOmail.Attachment "c:\data\testmail.xlsx"

    • @ExcelMacroMania
      @ExcelMacroMania  3 місяці тому

      Check the code here: excelmacroclass.blogspot.com/2024/01/send-google-mail-from-excel-vba-macro.html
      That line should go inside the With block for CDOmail.
      With CDOmail
      ....
      .Attachment "c:\data\testmail.xlsx"
      .Send
      End With

  • @proxyhn
    @proxyhn 4 місяці тому

    How would one code this using typescript in excel?

    • @ExcelMacroMania
      @ExcelMacroMania  4 місяці тому

      I've never used a typescript library for Excel, but there's one for JavaScript. However, I don't know why you want to do that. If you create a macro in Excel use VBA, if you create a web app, use JavaScript or TypeScript or any other.

    • @proxyhn
      @proxyhn 4 місяці тому

      @@ExcelMacroManiathank you so much It worked! Just another question would you happen to know about how I could format the body text to add images and such

    • @proxyhn
      @proxyhn 4 місяці тому

      ⁠@@ExcelMacroManiasorry for the double comment, I figured out how to use html for images, but how would I set up the “setrequestheader” in the third example?

    • @ExcelMacroMania
      @ExcelMacroMania  4 місяці тому

      @@proxyhn Here's the HTTP request for the third method (using a Google script/API):
      With HTTPreq
      .Open "POST", url, False
      .setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"
      .setRequestHeader "Content-type", "text/plain"
      .send body
      End With

  • @parasgupta1786
    @parasgupta1786 5 місяців тому

    Hi, this is something i have been trying to replicate. I tried using the second method from your tutorial. But unable to make it work. can you please help?
    I keep getting the error "Run-time error. The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available"

    • @ExcelMacroMania
      @ExcelMacroMania  4 місяці тому

      Make sure the code is correct, there was a mistake in the video that I corrected later, maybe you didn't watch the whole video. Also, go to your google account and get the exact address of the smtp server (usually is smtp.gmail.com, but can be different). Try with other port (465 vs 25 vs other?). Make sure you have added the right references to the VBA project. There might be some restrictions in your network, etc. You can find the code here: excelmacroclass.blogspot.com/2024/01/send-google-mail-from-excel-vba-macro.html