Avatar of celmajj
celmajj
 asked on

Excel macro : sending attachement to Outlook 2010 give execution error 440

Dear All,

I have the macro below :

Sub Envoyer_Pointage_Préfac_GEFCO_Décade1()
'

    Sheets("RECAP DECADE 1").Select
    Sheets("RECAP DECADE 1").Copy
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:= _
        "c:\trash2\Pointage anomalies Préfac GEFCO Décade 1.xlsx", _
        FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    Cells.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("A1").Select
    Application.DisplayAlerts = False
    ActiveWorkbook.Save
    Application.DisplayAlerts = False
    ActiveWindow.Close
   
   
   
Application.DisplayAlerts = False
Worksheets("RECAP DECADE 1").Range("A1:C75").Select

               ActiveWorkbook.EnvelopeVisible = True
               With ActiveSheet.MailEnvelope
                   .Introduction = "Bonjour, Après le pointage de vos éléments de préfacturation, les anomalies en PJ ont été constatées. Merci de bien vouloir effectuer les vérifications qui s'imposent avant de rédiger vos factures sur chacun des comptes sur la base des montants ci-dessous. Cordialement"
                   .Item.To = "toto_danil@contoso.com"
                   .Item.CC = ""
                   .Item.Subject = "Pointage Préfac GEFCO Décade 1"
                   .Item.Attachments.Add = "c:\trash2\Pointage anomalies Préfac GEFCO Décade 1.xlsx"
                   .Item.Send
               End With



That :

select a sheet
copy that sheet to a new worksheet
Save it to a new worksheet name
Copy and paste a selection
save it
close the active workboot


I got th error message "execution error 440"
on the yellow line on the file attached

Any clues?
excelmacro.PNG
Microsoft ExcelOutlook

Avatar of undefined
Last Comment
[ fanpages ]

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
[ fanpages ]

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
celmajj

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
[ fanpages ]

You are welcome.

This page may help:

[ https://msdn.microsoft.com/en-us/library/office/ff869553.aspx ]
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23