• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Need Macros

ashfaqbsayed

New Member
I want a macros which can send a email from email client base and i'm using Zimbra, that means not from outlook, and email should be send in html format that is color and font should remain the same which i have in excel, it should pick up the range for eg: c1 to q56 it should copy paste and send it ...
File attached for your reference..

Below is the macros which i'm trying, but does not work properly

Code:
Sub CDO_Send_Selection_Or_Range_Body()
    Dim rng As Range
    Dim iMsg As Object
    Dim iConf As Object
 
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
 
    ' iConf.Load -1 ' CDO Source Defaults
    ' Set Flds = iConf.Fields
    ' With Flds
    '      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    '      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Fill in your SMTP server here"
    '      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    '      .Update
    ' End With
 
    Set rng = Sheets("Hourly").Range("c1:q71").SpecialCells(xlCellTypeVisible)
    Set rng = ActiveSheet.Range("c1:q71")
    Set rng = Sheets("hourly").Range("c1:q71")
 
    On Error Resume Next
    Set rng = Sheets("Hourly").Range("c1:q71").Selection.SpecialCells(xlCellTypeVisible)
    On Error GoTo 0
 
    If rng Is Nothing Then
      MsgBox "The selection is not a range or the sheet is protected" & _
                                vbNewLine & "please correct and try again.", vbOKOnly
      Exit Sub
    End If
 
    With Application
        .EnableEvents = False
        .ScreenUpdating = False
    End With
 
    With iMsg
        Set .Configuration = iConf
        .To = "ababulal@lesterinc.com"
        .CC = ""
        .BCC = ""
        .From = """Ashfaq"" <ababulal@lesterinc.com>"
        .Subject = "This is a test"
        .HTMLBody = Range("c1:q71")
        .Send
    End With
 
    With Application
        .EnableEvents = True
        .ScreenUpdating = True
    End With
End Sub

Any help will be appreciated
Thanks,
Ashfaq Sayed.
 

Attachments

  • Dailypoints (1).xlsm
    615 KB · Views: 1
Hi, ashfaqbsayed!
In my case I've never heard before about Zimbra, have you tried posting this question at a Zimbra forum?
Regards!
 
I have posted on zimbra also just few minutes back, still help required if any one can help to send email from this macros
 
Hi Sayed ,

While you wait for any answers , either from this forum or from the Zimbra forum , can you clarify two points ?

1. Have you tried using Outlook and seen whether this procedure works ? This will confirm that whatever commands you have used in the procedure are adequate to do the job reliably.

2. When you use it with Zimbra , which statement gives problems , if any ? You have posted that the procedure does not work properly ; what does this mean ? Does it give any runtime error , or does it run and not produce any output ?

Narayan
 
No, I don't thing this macros will run with outlook.
I have a different macro which run's on outlook to follow same procedure, below is that macros for your reference and this works perfect.
Sub Send_Range()

' Select the range of cells on the active worksheet.
ActiveSheet.Range("c1:aa88").Select

' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = True

' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Introduction = "This is a sample worksheet."
.Item.To = "E-Mail_Address_Here"
.Item.Subject = "My subject"
.Item.Send
End With
End Sub
 
Hi, ashfaqbsayed!
As you might have guessed yet these are Excel forums, and despite of it sometimes there're contributors that are able and willing to answer questions regarding other software, most usually Access, Word, Powerpoint, Outlook, MS Office products, SQL Server, and surprisingly a few times about almost unknown products.
Well, this doesn't seem to be the case.
And at least in my case Zimbra enters in this last category: unknown. I'd bet that it's the same for a lot of members, so as I suggested earlier you should try on a Zimbra forum.
Writing new posts without adding any useful information and just for bumping up the topic won't result necessarily in more or better solutions, but perhaps discouraging people to click again on this topic.
Regards!
 
Hi Sayed ,

1. The runtime error 13 is a common error , and there can be many reasons for it , one of which may be Zimbra ; in case you want more information on this error , read this :

http://www.compuchenna.com/runtime-error-13/

Please do not try to modify the registry as detailed in the link.

What you can do is run the same code on other computers and see if the error , and the line on which it occurs are the same.

2. Most of the complaints on the Zimbra website regarding Excel appear to be unresolved ; Zimbra seems to be quite buggy ! Are you absolutely sure your Zimbra installation is perfect , with all the required files installed ?

Narayan
 
Back
Top