Run-time error 424
Hej Eksperter:Forsøger at afvikle følgende macro i Outlook 2003:
Sub ConfirmSaveEmailContent()
svar = MsgBox("Vil du overføre indholdet af denne e-mail?", vbYesNo + vbQuestion + vbDefaultButton1, "Bekræft overførsel")
If svar = vbYes Then
GetEmailContent
End If
End Sub
Private Sub GetEmailContent()
Dim myItems, myItem, myBodyContent As Object
Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
'work on selected items
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
For Each myItem In myOlSel
Set myItem.BodyFormat = olFormatRichText
Set myBodyContent = myItem.Body
Next
MsgBox "Indholdet blev overført korrekt!", vbOKOnly + vbInformation, "Overført indhold"
Set myBody = Nothing
Set myItems = Nothing
Set myItem = Nothing
Set myAttachments = Nothing
Set myAttachment = Nothing
Set myOlApp = Nothing
Set myOlExp = Nothing
Set myOlSel = Nothing
End Sub
Ved afvikling får jeg fejlen 'Run-time error 424 - Object required'.
Resultatet af funktionen skulle være, at den skriver indholdet af en åben e-mail.
Kan nogen hjælpe med dette?
På forhånd tak.
