Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I get this message:
Automation error. The specified module could not be found. When I run this code: Sub CreateTask() Dim objApp As Outlook.Application Dim objTask As Outlook.TaskItem Set objApp = CreateObject("Outlook.Application") Set objTask = objApp.CreateItem(olTaskItem) With objTask .Subject = "Subject" .StartDate = CDate(ProximaFechaAcumulada) - CDate(15) .DueDate = CDate(ProximaFechaAcumulada) .Importance = olImportanceHigh .Body = "Body" 'Here I need Right to Left .Save .ReminderSet = True End With End Sub It fails on this line: Set objApp = CreateObject("Outlook.Application") I dont understand this behavior. I have checked the Reference to MS Outlook Object Library on my system and Im having a problem with the code. I tried to create a small tool to simplify things in our office, but it just doesnt seem to work right. When I go to a few other machines in the office it runs fine. I cant tell whats going on. Perhaps there is some kind of esoteric setting that is different on my workstation... Id appreciate it if someone could share some insight. Regards, Ryan-- -- RyGuy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
By chance do you have Outlook running when trying to run this macro? If so,
the code will fail because only one instance of OUtlook can be open at any time. Instead, try this code: Sub GetOutlookReference() 'Outlook objects Dim olApp As Outlook.Application 'Obtain a reference to Outlook On Error Resume Next Set olApp = GetObject(, "Outlook.Application") 'If Outlook isn't running, start it and remember If olApp Is Nothing Then Set olApp = CreateObject("Outlook.Application") End If ' If Outlook still isn't running, Outlook cannot open or is not installed If olApp Is Nothing Then Call MsgBox("Outlook could not be opened. Exiting macro.", _ vbCritical, Application.Name) End If End Sub I cannot test this code since we do not have Outlook at work, but if you still need help, I can test it at home. Otherwise, here's a link to the Outlook VBA Newsgroup: http://msdn.microsoft.com/newsgroups.... outlook.vba Matthew Pfluger "ryguy7272" wrote: I get this message: Automation error. The specified module could not be found. When I run this code: Sub CreateTask() Dim objApp As Outlook.Application Dim objTask As Outlook.TaskItem Set objApp = CreateObject("Outlook.Application") Set objTask = objApp.CreateItem(olTaskItem) With objTask .Subject = "Subject" .StartDate = CDate(ProximaFechaAcumulada) - CDate(15) .DueDate = CDate(ProximaFechaAcumulada) .Importance = olImportanceHigh .Body = "Body" 'Here I need Right to Left .Save .ReminderSet = True End With End Sub It fails on this line: Set objApp = CreateObject("Outlook.Application") I dont understand this behavior. I have checked the Reference to MS Outlook Object Library on my system and Im having a problem with the code. I tried to create a small tool to simplify things in our office, but it just doesnt seem to work right. When I go to a few other machines in the office it runs fine. I cant tell whats going on. Perhaps there is some kind of esoteric setting that is different on my workstation... Id appreciate it if someone could share some insight. Regards, Ryan-- -- RyGuy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating Outlook Task from Excel | Excel Programming | |||
Searching for an Outlook Task from Excel | Excel Programming | |||
Sending task to Outlook from Excel | Excel Programming | |||
Sending a task from Excel to Outlook | Excel Programming | |||
import outlook task to excel | Excel Programming |