Dtown266
Nuclear
- Oct 31, 2006
- 47
I've create a macro to automatically create an email. But when i run the code. I get an error saying active x component cannot create object (refering to CreateObject("Outlook.Application")). However this code works on other machines. I am a newbie what should i Do?
any and all help will be appreciated
I've posted the code below.
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim olmailItem As Outlook.MailItem
Dim strBodytext As String
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(olFolderInbox)
Set olmailItem = olFolder.Items.Add("IPM.Note")
strBodytext = Msg
With olmailItem
.Subject = Subj
.To = Email
.Body = strBodytext
.Display
End With
Set olmailItem = Nothing
Set olFolder = nothinh
Set olNS = Nothing
Set olApp = Nothing
any and all help will be appreciated
I've posted the code below.
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
Dim olmailItem As Outlook.MailItem
Dim strBodytext As String
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(olFolderInbox)
Set olmailItem = olFolder.Items.Add("IPM.Note")
strBodytext = Msg
With olmailItem
.Subject = Subj
.To = Email
.Body = strBodytext
.Display
End With
Set olmailItem = Nothing
Set olFolder = nothinh
Set olNS = Nothing
Set olApp = Nothing