+ Reply to Thread
Results 1 to 4 of 4

Thread: Mail with macro Excel 2010

  1. #1
    Registered User
    Join Date
    12-05-2011
    Location
    Sweden
    MS-Off Ver
    Excel 2010
    Posts
    1

    Mail with macro Excel 2010

    I am very new at writing VB and have managed to send an email with Excel 2003. When I had to upgrade to 2010 so ended this to work. Is there anyone who could help me to make this work in Excel 2010. I have a problem with the format of date and when I save as. The file I'm working on now. Xlsm
    Please i need help!!
    Sub E_Post_Zon_1()
    '
    ' Mail Macro
    ' Macro recorded 2011-07-06 by Santors
            Range("B8").Select
        ActiveCell.FormulaR1C1 = "61000"
        Range("B9").Select
       ' Dim strDate As String
         ActiveSheet.Copy
        strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss")
        ActiveWorkbook.SaveAs "Test Stockholm" & ThisWorkbook.Name _
            & " " & strDate & ".xls"
        ActiveWorkbook.SendMail "santors71@gmail.com", _
            "Test Bonus "
        ActiveWorkbook.ChangeFileAccess xlReadOnly
        Kill ActiveWorkbook.FullName
        ActiveWorkbook.Close True
    
    END SUB


    Regards Santors
    Last edited by Santors; 12-08-2011 at 08:15 AM.

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel 2007
    Posts
    825

    Re: Mail with macro Excel 2010

    hi Santors

    duplicate
    sorry
    Last edited by john55; 12-05-2011 at 03:29 AM.
    Regards, John

  3. #3
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel 2007
    Posts
    825

    Re: Mail with macro Excel 2010

    hi Santors
    please edit yr post adding [] before yr first line of code and [/] after tle last line. add the word code in between
    Regards, John

  4. #4
    Valued Forum Contributor JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    Japan
    MS-Off Ver
    Excel 2010
    Posts
    779

    Re: Mail with macro Excel 2010

    Hey Here is the code ,
    Code:
    Option Explicit
    
    Sub Dave()
    
    Dim strDate As String
    
            Range("B8").Value = "61000"
               ActiveSheet.Copy
                 strDate = Format(Date, "dd-mm-yy") & " " & Format(Time, "h-mm-ss")
                    ActiveWorkbook.SaveAs "Test Stockholm" & ThisWorkbook.Name _
                       & " " & strDate & ".xlsm", FileFormat:=52
                    ActiveWorkbook.SendMail "your.email@gmail.com", _
                    "Test Bonus "
                 ActiveWorkbook.ChangeFileAccess xlReadOnly
              Kill ActiveWorkbook.FullName
            ActiveWorkbook.Close True
    
    End Sub
    If you are happy with the answer, please click the Star icon in the below left hand corner.

    Good sites to start learning.

    snb's VBA Help Files
    Jerry Beaucaires Excel Assistant
    J & R Excel Consultancy Services

    How to post code correctly: Correct Code Posting

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0