Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a question.
How do you define the following Sub CreateTask() Dim olApp As Outlook.Application Dim olTsk As TaskItem Set olApp = New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = olTaskInProgress .Importance = olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub When I run this code I get an error stating "User-Definded type not defined" Pete |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With "Early Binding" to Outlook you need to "check" the reference to MS
Outlook in Tools - References. Alternatively you can switch to "Late Binding" with the following changes to your code Dim olApp As Object ' Outlook.Application Dim olTsk As Object ' TaskItem Set olApp = CreateObject("outlook.application") ' New Outlook.Application 'code ..Status = 1 ' olTaskInProgress ..Importance = 2 ' olImportanceHigh 'code If there is any possibility of a user of your file having an older version of Outlook than yours, use the Late Binding method. Regards, Peter T "Looping through" wrote in message ... I have a question. How do you define the following Sub CreateTask() Dim olApp As Outlook.Application Dim olTsk As TaskItem Set olApp = New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = olTaskInProgress .Importance = olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub When I run this code I get an error stating "User-Definded type not defined" Pete |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Peter T.
I made you suggested changes and get a run time error 438 "Object does not support this property or method" Maybe I did not change everything exactly like you intended. Here is my revised code. Sub CreateTask_test() Dim olApp As Object Dim olTsk As Object Set olApp = CreateObject("outlook.application") ' New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = 1 ' olTaskInProgress .Importance = 2 ' olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub What did I miss. Peter "Peter T" wrote: With "Early Binding" to Outlook you need to "check" the reference to MS Outlook in Tools - References. Alternatively you can switch to "Late Binding" with the following changes to your code Dim olApp As Object ' Outlook.Application Dim olTsk As Object ' TaskItem Set olApp = CreateObject("outlook.application") ' New Outlook.Application 'code ..Status = 1 ' olTaskInProgress ..Importance = 2 ' olImportanceHigh 'code If there is any possibility of a user of your file having an older version of Outlook than yours, use the Late Binding method. Regards, Peter T "Looping through" wrote in message ... I have a question. How do you define the following Sub CreateTask() Dim olApp As Outlook.Application Dim olTsk As TaskItem Set olApp = New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = olTaskInProgress .Importance = olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub When I run this code I get an error stating "User-Definded type not defined" Pete |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I didn't test so I might have missed something. Best approach is to develop
with "Early Binding", then change to "Late Binding" if any user might not have as late a version as your Outlook installed. So for testing set the reference as I suggested last time and test your original code. Head the module "Option Explicit" without quotes, anything incorrect will be highlit as soon as you start to run the routine. When all appears OK, adapt to Late Binding along the lines I suggested, if I missed something it'll soon become apparent and hopefully obvious what else needs changing Regards, Peter T "Looping through" wrote in message ... Thanks Peter T. I made you suggested changes and get a run time error 438 "Object does not support this property or method" Maybe I did not change everything exactly like you intended. Here is my revised code. Sub CreateTask_test() Dim olApp As Object Dim olTsk As Object Set olApp = CreateObject("outlook.application") ' New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = 1 ' olTaskInProgress .Importance = 2 ' olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub What did I miss. Peter "Peter T" wrote: With "Early Binding" to Outlook you need to "check" the reference to MS Outlook in Tools - References. Alternatively you can switch to "Late Binding" with the following changes to your code Dim olApp As Object ' Outlook.Application Dim olTsk As Object ' TaskItem Set olApp = CreateObject("outlook.application") ' New Outlook.Application 'code ..Status = 1 ' olTaskInProgress ..Importance = 2 ' olImportanceHigh 'code If there is any possibility of a user of your file having an older version of Outlook than yours, use the Late Binding method. Regards, Peter T "Looping through" wrote in message ... I have a question. How do you define the following Sub CreateTask() Dim olApp As Outlook.Application Dim olTsk As TaskItem Set olApp = New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = olTaskInProgress .Importance = olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub When I run this code I get an error stating "User-Definded type not defined" Pete |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following line gets an Compile Error "Varible Not defined"
Set olTsk = olApp.createitem(OLTaskitem) Peter "Peter T" wrote: I didn't test so I might have missed something. Best approach is to develop with "Early Binding", then change to "Late Binding" if any user might not have as late a version as your Outlook installed. So for testing set the reference as I suggested last time and test your original code. Head the module "Option Explicit" without quotes, anything incorrect will be highlit as soon as you start to run the routine. When all appears OK, adapt to Late Binding along the lines I suggested, if I missed something it'll soon become apparent and hopefully obvious what else needs changing Regards, Peter T "Looping through" wrote in message ... Thanks Peter T. I made you suggested changes and get a run time error 438 "Object does not support this property or method" Maybe I did not change everything exactly like you intended. Here is my revised code. Sub CreateTask_test() Dim olApp As Object Dim olTsk As Object Set olApp = CreateObject("outlook.application") ' New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = 1 ' olTaskInProgress .Importance = 2 ' olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub What did I miss. Peter "Peter T" wrote: With "Early Binding" to Outlook you need to "check" the reference to MS Outlook in Tools - References. Alternatively you can switch to "Late Binding" with the following changes to your code Dim olApp As Object ' Outlook.Application Dim olTsk As Object ' TaskItem Set olApp = CreateObject("outlook.application") ' New Outlook.Application 'code ..Status = 1 ' olTaskInProgress ..Importance = 2 ' olImportanceHigh 'code If there is any possibility of a user of your file having an older version of Outlook than yours, use the Late Binding method. Regards, Peter T "Looping through" wrote in message ... I have a question. How do you define the following Sub CreateTask() Dim olApp As Outlook.Application Dim olTsk As TaskItem Set olApp = New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = olTaskInProgress .Importance = olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub When I run this code I get an error stating "User-Definded type not defined" Pete |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Did it all work with the reference to Outlook (early binding). ?
Set the OL reference. in Tools - Ref's In the immediate window, ctrl-g, place the cursor after ?OLTaskitem and hit enter remember, first set the reference to OL. You should find the constant value for OLTaskitem in the OL library is 3 Revert to Late Binding (if you really need to do it that way) and change Set olTsk = olApp.createitem(OLTaskitem) to Set olTsk = olApp.createitem(3) ' OLTaskitem Do similar for any other constants I may have missed (I still haven't tested it). Regards, Peter T "Looping through" wrote in message ... The following line gets an Compile Error "Varible Not defined" Set olTsk = olApp.createitem(OLTaskitem) Peter "Peter T" wrote: I didn't test so I might have missed something. Best approach is to develop with "Early Binding", then change to "Late Binding" if any user might not have as late a version as your Outlook installed. So for testing set the reference as I suggested last time and test your original code. Head the module "Option Explicit" without quotes, anything incorrect will be highlit as soon as you start to run the routine. When all appears OK, adapt to Late Binding along the lines I suggested, if I missed something it'll soon become apparent and hopefully obvious what else needs changing Regards, Peter T "Looping through" wrote in message ... Thanks Peter T. I made you suggested changes and get a run time error 438 "Object does not support this property or method" Maybe I did not change everything exactly like you intended. Here is my revised code. Sub CreateTask_test() Dim olApp As Object Dim olTsk As Object Set olApp = CreateObject("outlook.application") ' New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = 1 ' olTaskInProgress .Importance = 2 ' olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub What did I miss. Peter "Peter T" wrote: With "Early Binding" to Outlook you need to "check" the reference to MS Outlook in Tools - References. Alternatively you can switch to "Late Binding" with the following changes to your code Dim olApp As Object ' Outlook.Application Dim olTsk As Object ' TaskItem Set olApp = CreateObject("outlook.application") ' New Outlook.Application 'code ..Status = 1 ' olTaskInProgress ..Importance = 2 ' olImportanceHigh 'code If there is any possibility of a user of your file having an older version of Outlook than yours, use the Late Binding method. Regards, Peter T "Looping through" wrote in message ... I have a question. How do you define the following Sub CreateTask() Dim olApp As Outlook.Application Dim olTsk As TaskItem Set olApp = New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = olTaskInProgress .Importance = olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub When I run this code I get an error stating "User-Definded type not defined" Pete |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
OLTaskitem didn't get changed to a constant like these did:
.Status = 1 ' olTaskInProgress .Importance = 2 ' olImportanceHigh If you open Outlook, go into the VBE, you can hit ctrl-g to see the immediate window. Then type: ?OLTaskitem And you'll see that this is equal to 3. so this: Set olTsk = olApp.CreateItem(olTaskItem) becomes: Set olTsk = olApp.CreateItem(3) Looping through wrote: The following line gets an Compile Error "Varible Not defined" Set olTsk = olApp.createitem(OLTaskitem) Peter "Peter T" wrote: I didn't test so I might have missed something. Best approach is to develop with "Early Binding", then change to "Late Binding" if any user might not have as late a version as your Outlook installed. So for testing set the reference as I suggested last time and test your original code. Head the module "Option Explicit" without quotes, anything incorrect will be highlit as soon as you start to run the routine. When all appears OK, adapt to Late Binding along the lines I suggested, if I missed something it'll soon become apparent and hopefully obvious what else needs changing Regards, Peter T "Looping through" wrote in message ... Thanks Peter T. I made you suggested changes and get a run time error 438 "Object does not support this property or method" Maybe I did not change everything exactly like you intended. Here is my revised code. Sub CreateTask_test() Dim olApp As Object Dim olTsk As Object Set olApp = CreateObject("outlook.application") ' New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = 1 ' olTaskInProgress .Importance = 2 ' olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub What did I miss. Peter "Peter T" wrote: With "Early Binding" to Outlook you need to "check" the reference to MS Outlook in Tools - References. Alternatively you can switch to "Late Binding" with the following changes to your code Dim olApp As Object ' Outlook.Application Dim olTsk As Object ' TaskItem Set olApp = CreateObject("outlook.application") ' New Outlook.Application 'code ..Status = 1 ' olTaskInProgress ..Importance = 2 ' olImportanceHigh 'code If there is any possibility of a user of your file having an older version of Outlook than yours, use the Late Binding method. Regards, Peter T "Looping through" wrote in message ... I have a question. How do you define the following Sub CreateTask() Dim olApp As Outlook.Application Dim olTsk As TaskItem Set olApp = New Outlook.Application Set olTsk = olApp.CreateItem(olTaskItem) With olTsk .Subject = "Update Web Site" .Status = olTaskInProgress .Importance = olImportanceHigh .DueDate = DateValue("06/26/03") .TotalWork = 40 .ActualWork = 20 .Save End With Set olTsk = Nothing Set olApp = Nothing End Sub When I run this code I get an error stating "User-Definded type not defined" Pete -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
User Defined Type not Defined error | Excel Programming | |||
"User-defined type not defined" message in Excel | Excel Discussion (Misc queries) | |||
Workspace faux user-defined type not defined | Excel Programming | |||
User-defined data type; Error: Only User-defined types... | Excel Programming | |||
Word.Document - user defined type not defined | Excel Programming |