Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default User Defined not defind

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default User Defined not defind

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default User Defined not defind

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default User Defined not defind

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default User Defined not defind

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default User Defined not defind

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default User Defined not defind

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Defined Type not Defined error Chip Pearson Excel Programming 0 December 7th 06 07:09 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
Workspace faux user-defined type not defined Chris S[_2_] Excel Programming 3 November 11th 04 05:51 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
Word.Document - user defined type not defined jowatkins[_7_] Excel Programming 0 January 20th 04 08:46 AM


All times are GMT +1. The time now is 08:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"