Results 1 to 7 of 7

Email Workbook macro not working with Windows 7

Threaded View

  1. #1
    Registered User
    Join Date
    01-06-2012
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010, Excel 365
    Posts
    49

    Exclamation Email Workbook macro not working with Windows 7

    I have the following code:

    Sub EmailWorkbookToCoreAccounts()
        
        xlsmname = Range("A2").Value
        Edate = Format(Now, "MM-DD-YYYY hhmm")
        ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\All Users\Desktop\" & xlsmname & "_" & Format(Edate, "MM-DD-YYYY hhmm") & ".xlsm", FileFormat:=52, CreateBackup:=False
        
        Dim OutApp As Object
        Dim OutMail As Object
    
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
        On Error Resume Next
        With OutMail
            .To = "[email protected]"
            .CC = ""
            .BCC = ""
            .Subject = xlsmname
            .Body = ""
            .Attachments.Add ActiveWorkbook.FullName
            .Display
        End With
        On Error GoTo 0
    
        Set OutMail = Nothing
        Set OutApp = Nothing
        
    End Sub
    The code first saves the workbook to the user's desktop then starts an email (via Outlook) with the workbook attached. It seems that this code works perfectly with Windows XP, but doesn't work with Windows 7 - any ideas on how to fix this?

    Edit Post 7-19-12 3:19pm:
    I should mention that in Windows 7 the macro will save the workbook to the desktop, start an email, but it doesn't attach the workbook to the email.
    Last edited by Lewej23; 08-03-2012 at 01:46 PM.

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.6.0 RC 1