Mailfunktion via VBA som har virket hidtil
Jeg har en funktion som har virket upåklageligt i meget lang tid, som pludselig ikke virker mere. Den er nævnt nedenfor. Kan nogen se hvor den er skrøbelig eller forkert - eller?Så vidt jeg kan se stopper funktionen ved linie 4 (indsat linienumre i linierne fra VBA).
Det kører i Excel 2007. I Tools/reference har jeg sat hak ved Microsoft Office Outlook 12.0 Objekt Library
1 Dim olApp As Outlook.Application
2 Dim olNewMail As Outlook.MailItem
3 Set olApp = New Outlook.Application
4 Set olNewMail = CreateItem(olMailItem)
5 With olNewMail
6 .To = Sheets("Ark1").Range("M31").Value
7 .CC = Sheets("Ark1").Range("L15").Value
8 .Subject = Sheets("Ark1").Range("P18").Value
9 .HTMLBody = RangetoHTML(RngFor) '& "<br>" & Signature
10 .Display
11 .Attachments.Add PDF1
12 .Attachments.Add PDF2
13 .Attachments.Add PDF3
14 .Attachments.Add PDF4
15 .Attachments.Add PDF5
16 .Attachments.Add PDF6
17 End With
18 Set olNewMail = Nothing
19 Set olApp = Nothing
