Problem on sending emails with Excel RRS feed

  • Question

  • Hi...I have a simple macro that sends emails.

        With OutMail
            .SentOnBehalfOfName = ""
            .To = strto
            .CC = carbon
            .BCC = ""
            .Subject = "Important Information for your event " & ActiveCell.Offset(0, -7).Value
            .HTMLBody = strbody
        End With

    strto is defined as the current value of the cell and carbon is defined as other value in other cell. Those variables are defined as strings.  if check the values of those variables I see for example "" and "" which are correct.

    The problem is that the email is not sent and I get no error. if I hardcode the values instead of the variables with the following:

        With OutMail
            .SentOnBehalfOfName = ""
            .To = ""
            .CC = ""
            .BCC = ""
            .Subject = "Important Information for your event " & ActiveCell.Offset(0, -7).Value
            .HTMLBody = strbody
        End With

    the email is sent.

    I checked that the values on the cells that populate the variables are correct, no spaces or weird characters...

    I'm using this on a VM with Azure with Office installed on it. Could it be some configuration needed? I ran this on a windows 10 machine and it works.

    Anyone can help me to solve the problem?



    Thursday, December 15, 2016 3:55 PM

All replies

  • First make sure, that the variables are populated corretly.

    Put this code line...

    MsgBox strto & vbNewLine & carbon

    ...right before the 'With OutMail' code line.

    Does the variables actually contains the proper mail addresses?

    Friday, December 16, 2016 7:49 AM
  • Hi,

    If your issue is resolved, i suggest you share the solution with us or mark helpful post as answer.

    If your issue still exists, i suggest you output the value like Pistolprinsen suggested and compare them.

    You could also try to set the cell value in the code again and then pass the cellvalue to the variable and check if there is difference.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Friday, December 23, 2016 9:46 AM