No matter what I try, I can't get this to work. I have used the sample application in Chapter 16. I have opened the VBA editor, Selected Tool / References and made sure the Check is on for Microsoft Outlook 12.0 Object Library.... But every time I run the code under the button I get the Error Message Run-time '429': ActiveX component can't create object..... When I select debug the offending line of code is:
Set olApp = CreateObject("Outlook.Application")
Here is the entire sub:
Private Sub cmdAlert_Click()
Dim strBodyText As String
'Reference the Outlook Application
Dim olApp As Outlook.Application
'The NameSpace object allows you to reference folders
Dim olNS As Outlook.NameSpace
Dim olFolder As Outlook.MAPIFolder
'Create a reference to the email item you will use to send your email
Dim olMailItem As Outlook.MailItem
'Create the Outlook objects
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
Set olFolder = olNS.GetDefaultFolder(olFolderInbox)
Set olMailItem = olFolder.Items.Add("IPM.Note")
'Create the body of the message from the data in the form
strBodyText = "Material for Order #" & Me.OrderNumber & vbCrLf & _
"Order Due Date: " & Me.OrderDate & vbCrLf & _
"Action: Inform customer it will be late"
'Update the new mail object with your data
With olMailItem
.Subject = "Material Delay for Order #" & Me.OrderNumber
.To = "
[email protected]"
.Body = strBodyText
.Importance = olImportanceHigh
.FlagStatus = olFlagMarked
.FlagDueBy = Date + 2
.Display
'.Send
End With
'Release all of your object variables
Set olMailItem = Nothing
Set olFolder = Nothing
Set olNS = Nothing
Set olApp = Nothing
End Sub
I have been all over Microsoft to solve this, I have read every manual I have, I even bought this book to solve it and It just won't work.... Any suggestions?
Thanks,
Maxgrunt