A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Adding an Outlook task from Access



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 7th 06, 01:01 AM posted to microsoft.public.outlook.program_vba
Blogd_Node
external usenet poster
 
Posts: 7
Default Adding an Outlook task from Access

Hi,

Config is XP SP2 / Access 2003 / Outlook 2003
Access Refs are VBA / Access 11 / SafeOutlook / DAO 3.6 / Outlook 11 /
Calendar 11

I want to add an Outlook Task from Access.
The problem is Outlook crashes (sometimes) if not open.

Any thoughts about where I'm going wrong ?
( I know just enough VB code to be a danger to myself... )
:-)

Many thanks...

David

(Some Access code below has been snipped for clarity...)

'CODE ===============================================
Private Sub cmdCreateTask_Click()

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Object
Dim myItem As Object
Dim objSafeTaskItem As Redemption.SafeTaskItem
Dim myNS As NameSpace
Dim timeX As String
Dim strVia As String
Dim strReg As String

On Error Resume Next

Set objOL = GetObject(, "Outlook.Application")

'If outlook is not running, then
If objOL Is Nothing Then

Set objOL = CreateObject("Outlook.Application")
Set myNS = objOL.GetNamespace("MAPI")
myNS.Logon

End If

On Error GoTo 0

' Set up Outlook Objects.
' If there is a date set
If Len(Me!ChaseDateCalendar & "") 0 Then

Set myItem = objOL.CreateItem(olTaskItem) 'Outlook Task Item
Set objSafeTaskItem = CreateObject("Redemption.safeTaskItem")

objSafeTaskItem.Item = myItem

With objSafeTaskItem

.Subject = Format(Me!ChaseDate, "dd-mmm-yy") & " ChaseUp " &
Trim(Me![FirstName]) & " " & _
Trim(Me![Surname]) & " " & "Via: " & Trim(strVia) & " " & _
" " & Trim(Me![cmbRegarding]) & " " & Trim(Me![txtAddedNote])
Me!Memo = Me!Memo & vbCrLf & .Subject
.Body = "Add any comments about this chaseup into DATABASE - not
here"
.ReminderSet = True
'Remind at 9AM
.ReminderTime = FormatDateTime(timeX, 4)
'Due at selected date
.DueDate = Format(Me!ChaseDate, "dd-mmm-yy")
.ReminderPlaySound = True
'Modify path.
'.ReminderSoundFile = "C:\WINNT\Media\Ding.wav"
.Save

End With

Else

MsgBox "No ChaseUp Date set?"

End If

Exit_cmdCreateTask_Click:
Set objSafeTaskItem = Nothing
Set objOL = Nothing
Exit Sub

Err_cmdCreateTask_Click:

MsgBox Err.Description
Resume Exit_cmdCreateTask_Click

End Sub


Ads
  #2  
Old June 7th 06, 07:38 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Adding an Outlook task from Access

Am Wed, 7 Jun 2006 09:01:21 +1000 schrieb Blogd_Node:

Where do you get which error?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi,

Config is XP SP2 / Access 2003 / Outlook 2003
Access Refs are VBA / Access 11 / SafeOutlook / DAO 3.6 / Outlook 11 /
Calendar 11

I want to add an Outlook Task from Access.
The problem is Outlook crashes (sometimes) if not open.

Any thoughts about where I'm going wrong ?
( I know just enough VB code to be a danger to myself... )
:-)

Many thanks...

David

(Some Access code below has been snipped for clarity...)

'CODE ===============================================
Private Sub cmdCreateTask_Click()

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Object
Dim myItem As Object
Dim objSafeTaskItem As Redemption.SafeTaskItem
Dim myNS As NameSpace
Dim timeX As String
Dim strVia As String
Dim strReg As String

On Error Resume Next

Set objOL = GetObject(, "Outlook.Application")

'If outlook is not running, then
If objOL Is Nothing Then

Set objOL = CreateObject("Outlook.Application")
Set myNS = objOL.GetNamespace("MAPI")
myNS.Logon

End If

On Error GoTo 0

' Set up Outlook Objects.
' If there is a date set
If Len(Me!ChaseDateCalendar & "") 0 Then

Set myItem = objOL.CreateItem(olTaskItem) 'Outlook Task

Item
Set objSafeTaskItem = CreateObject("Redemption.safeTaskItem")

objSafeTaskItem.Item = myItem

With objSafeTaskItem

.Subject = Format(Me!ChaseDate, "dd-mmm-yy") & " ChaseUp " &
Trim(Me![FirstName]) & " " & _
Trim(Me![Surname]) & " " & "Via: " & Trim(strVia) & " " & _
" " & Trim(Me![cmbRegarding]) & " " & Trim(Me![txtAddedNote])
Me!Memo = Me!Memo & vbCrLf & .Subject
.Body = "Add any comments about this chaseup into DATABASE - not
here"
.ReminderSet = True
'Remind at 9AM
.ReminderTime = FormatDateTime(timeX, 4)
'Due at selected date
.DueDate = Format(Me!ChaseDate, "dd-mmm-yy")
.ReminderPlaySound = True
'Modify path.
'.ReminderSoundFile = "C:\WINNT\Media\Ding.wav"
.Save

End With

Else

MsgBox "No ChaseUp Date set?"

End If

Exit_cmdCreateTask_Click:
Set objSafeTaskItem = Nothing
Set objOL = Nothing
Exit Sub

Err_cmdCreateTask_Click:

MsgBox Err.Description
Resume Exit_cmdCreateTask_Click

End Sub

  #3  
Old June 7th 06, 08:46 AM posted to microsoft.public.outlook.program_vba
Blogd_Node
external usenet poster
 
Posts: 7
Default Adding an Outlook task from Access

Hi Michael,

Thanks for the reply.

No error messages from Access code.
First time through, code works OK.
Second time, Outlook stops dead with
a request to send an error report to MS.
When Outlook opens, it pops another message box
"The data file 'Personal Folders' was not closed properly.
The file is being checked for further problems."

Any thoughts ?

Regards

David
============================================
"Michael Bauer" wrote

Where do you get which error?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi,

Config is XP SP2 / Access 2003 / Outlook 2003
Access Refs are VBA / Access 11 / SafeOutlook / DAO 3.6 / Outlook 11 /
Calendar 11

I want to add an Outlook Task from Access.
The problem is Outlook crashes (sometimes) if not open.

Any thoughts about where I'm going wrong ?
( I know just enough VB code to be a danger to myself... )
:-)

Many thanks...

David

(Some Access code below has been snipped for clarity...)

'CODE ===============================================
Private Sub cmdCreateTask_Click()

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Object
Dim myItem As Object
Dim objSafeTaskItem As Redemption.SafeTaskItem
Dim myNS As NameSpace
Dim timeX As String
Dim strVia As String
Dim strReg As String

On Error Resume Next

Set objOL = GetObject(, "Outlook.Application")

'If outlook is not running, then
If objOL Is Nothing Then

Set objOL = CreateObject("Outlook.Application")
Set myNS = objOL.GetNamespace("MAPI")
myNS.Logon

End If

On Error GoTo 0

' Set up Outlook Objects.
' If there is a date set
If Len(Me!ChaseDateCalendar & "") 0 Then

Set myItem = objOL.CreateItem(olTaskItem) 'Outlook Task

Item
Set objSafeTaskItem = CreateObject("Redemption.safeTaskItem")

objSafeTaskItem.Item = myItem

With objSafeTaskItem

.Subject = Format(Me!ChaseDate, "dd-mmm-yy") & " ChaseUp " &
Trim(Me![FirstName]) & " " & _
Trim(Me![Surname]) & " " & "Via: " & Trim(strVia) & " " & _
" " & Trim(Me![cmbRegarding]) & " " &
Trim(Me![txtAddedNote])
Me!Memo = Me!Memo & vbCrLf & .Subject
.Body = "Add any comments about this chaseup into DATABASE - not
here"
.ReminderSet = True
'Remind at 9AM
.ReminderTime = FormatDateTime(timeX, 4)
'Due at selected date
.DueDate = Format(Me!ChaseDate, "dd-mmm-yy")
.ReminderPlaySound = True
'Modify path.
'.ReminderSoundFile = "C:\WINNT\Media\Ding.wav"
.Save

End With

Else

MsgBox "No ChaseUp Date set?"

End If

Exit_cmdCreateTask_Click:
Set objSafeTaskItem = Nothing
Set objOL = Nothing
Exit Sub

Err_cmdCreateTask_Click:

MsgBox Err.Description
Resume Exit_cmdCreateTask_Click

End Sub



  #4  
Old June 7th 06, 10:02 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Adding an Outlook task from Access

Am Wed, 7 Jun 2006 16:46:26 +1000 schrieb Blogd_Node:

I think you need to clean up one more ref at the end:

Set objSafeTaskItem = Nothing
Set objOL = Nothing


Should be:

Set objSafeTaskItem.Item=Nothing
Set objSafeTaskItem=Nothing

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi Michael,

Thanks for the reply.

No error messages from Access code.
First time through, code works OK.
Second time, Outlook stops dead with
a request to send an error report to MS.
When Outlook opens, it pops another message box
"The data file 'Personal Folders' was not closed properly.
The file is being checked for further problems."

Any thoughts ?

Regards

David
============================================
"Michael Bauer" wrote

Where do you get which error?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi,

Config is XP SP2 / Access 2003 / Outlook 2003
Access Refs are VBA / Access 11 / SafeOutlook / DAO 3.6 / Outlook 11 /
Calendar 11

I want to add an Outlook Task from Access.
The problem is Outlook crashes (sometimes) if not open.

Any thoughts about where I'm going wrong ?
( I know just enough VB code to be a danger to myself... )
:-)

Many thanks...

David

(Some Access code below has been snipped for clarity...)

'CODE ===============================================
Private Sub cmdCreateTask_Click()

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Object
Dim myItem As Object
Dim objSafeTaskItem As Redemption.SafeTaskItem
Dim myNS As NameSpace
Dim timeX As String
Dim strVia As String
Dim strReg As String

On Error Resume Next

Set objOL = GetObject(, "Outlook.Application")

'If outlook is not running, then
If objOL Is Nothing Then

Set objOL = CreateObject("Outlook.Application")
Set myNS = objOL.GetNamespace("MAPI")
myNS.Logon

End If

On Error GoTo 0

' Set up Outlook Objects.
' If there is a date set
If Len(Me!ChaseDateCalendar & "") 0 Then

Set myItem = objOL.CreateItem(olTaskItem) 'Outlook Task

Item
Set objSafeTaskItem = CreateObject("Redemption.safeTaskItem")

objSafeTaskItem.Item = myItem

With objSafeTaskItem

.Subject = Format(Me!ChaseDate, "dd-mmm-yy") & " ChaseUp " &
Trim(Me![FirstName]) & " " & _
Trim(Me![Surname]) & " " & "Via: " & Trim(strVia) & " " & _
" " & Trim(Me![cmbRegarding]) & " " &
Trim(Me![txtAddedNote])
Me!Memo = Me!Memo & vbCrLf & .Subject
.Body = "Add any comments about this chaseup into DATABASE - not
here"
.ReminderSet = True
'Remind at 9AM
.ReminderTime = FormatDateTime(timeX, 4)
'Due at selected date
.DueDate = Format(Me!ChaseDate, "dd-mmm-yy")
.ReminderPlaySound = True
'Modify path.
'.ReminderSoundFile = "C:\WINNT\Media\Ding.wav"
.Save

End With

Else

MsgBox "No ChaseUp Date set?"

End If

Exit_cmdCreateTask_Click:
Set objSafeTaskItem = Nothing
Set objOL = Nothing
Exit Sub

Err_cmdCreateTask_Click:

MsgBox Err.Description
Resume Exit_cmdCreateTask_Click

End Sub

  #5  
Old June 7th 06, 12:00 PM posted to microsoft.public.outlook.program_vba
Blogd_Node
external usenet poster
 
Posts: 7
Default Adding an Outlook task from Access

No -
That now fails with "Automation error"
at line
Set objSafeTaskItem.Item=Nothing

??

===============================================


"Michael Bauer" wrote

I think you need to clean up one more ref at the end:

Set objSafeTaskItem = Nothing
Set objOL = Nothing


Should be:

Set objSafeTaskItem.Item=Nothing
Set objSafeTaskItem=Nothing

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi Michael,

Thanks for the reply.

No error messages from Access code.
First time through, code works OK.
Second time, Outlook stops dead with
a request to send an error report to MS.
When Outlook opens, it pops another message box
"The data file 'Personal Folders' was not closed properly.
The file is being checked for further problems."

Any thoughts ?

Regards

David
============================================
"Michael Bauer" wrote

Where do you get which error?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi,

Config is XP SP2 / Access 2003 / Outlook 2003
Access Refs are VBA / Access 11 / SafeOutlook / DAO 3.6 / Outlook 11 /
Calendar 11

I want to add an Outlook Task from Access.
The problem is Outlook crashes (sometimes) if not open.

Any thoughts about where I'm going wrong ?
( I know just enough VB code to be a danger to myself... )
:-)

Many thanks...

David

(Some Access code below has been snipped for clarity...)

'CODE ===============================================
Private Sub cmdCreateTask_Click()

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Object
Dim myItem As Object
Dim objSafeTaskItem As Redemption.SafeTaskItem
Dim myNS As NameSpace
Dim timeX As String
Dim strVia As String
Dim strReg As String

On Error Resume Next

Set objOL = GetObject(, "Outlook.Application")

'If outlook is not running, then
If objOL Is Nothing Then

Set objOL = CreateObject("Outlook.Application")
Set myNS = objOL.GetNamespace("MAPI")
myNS.Logon

End If

On Error GoTo 0

' Set up Outlook Objects.
' If there is a date set
If Len(Me!ChaseDateCalendar & "") 0 Then

Set myItem = objOL.CreateItem(olTaskItem) 'Outlook Task
Item
Set objSafeTaskItem = CreateObject("Redemption.safeTaskItem")

objSafeTaskItem.Item = myItem

With objSafeTaskItem

.Subject = Format(Me!ChaseDate, "dd-mmm-yy") & " ChaseUp " &
Trim(Me![FirstName]) & " " & _
Trim(Me![Surname]) & " " & "Via: " & Trim(strVia) & " " & _
" " & Trim(Me![cmbRegarding]) & " " &
Trim(Me![txtAddedNote])
Me!Memo = Me!Memo & vbCrLf & .Subject
.Body = "Add any comments about this chaseup into DATABASE -
not
here"
.ReminderSet = True
'Remind at 9AM
.ReminderTime = FormatDateTime(timeX, 4)
'Due at selected date
.DueDate = Format(Me!ChaseDate, "dd-mmm-yy")
.ReminderPlaySound = True
'Modify path.
'.ReminderSoundFile = "C:\WINNT\Media\Ding.wav"
.Save

End With

Else

MsgBox "No ChaseUp Date set?"

End If

Exit_cmdCreateTask_Click:
Set objSafeTaskItem = Nothing
Set objOL = Nothing
Exit Sub

Err_cmdCreateTask_Click:

MsgBox Err.Description
Resume Exit_cmdCreateTask_Click

End Sub



  #6  
Old June 7th 06, 02:52 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Adding an Outlook task from Access

Try:

Set myItem =Nothing

Bottom line is that you need to dereference every Outlook object you use.

Also, if your code started Outlook, then you'll need to shut down Outlook, too, with an objOL.Quit statement.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Blogd_Node" wrote in message ...
No -
That now fails with "Automation error"
at line
Set objSafeTaskItem.Item=Nothing

??

===============================================


"Michael Bauer" wrote

I think you need to clean up one more ref at the end:

Set objSafeTaskItem = Nothing
Set objOL = Nothing


Should be:

Set objSafeTaskItem.Item=Nothing
Set objSafeTaskItem=Nothing

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi Michael,

Thanks for the reply.

No error messages from Access code.
First time through, code works OK.
Second time, Outlook stops dead with
a request to send an error report to MS.
When Outlook opens, it pops another message box
"The data file 'Personal Folders' was not closed properly.
The file is being checked for further problems."

Any thoughts ?

Regards

David
============================================
"Michael Bauer" wrote

Where do you get which error?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi,

Config is XP SP2 / Access 2003 / Outlook 2003
Access Refs are VBA / Access 11 / SafeOutlook / DAO 3.6 / Outlook 11 /
Calendar 11

I want to add an Outlook Task from Access.
The problem is Outlook crashes (sometimes) if not open.

Any thoughts about where I'm going wrong ?
( I know just enough VB code to be a danger to myself... )
:-)

Many thanks...

David

(Some Access code below has been snipped for clarity...)

'CODE ===============================================
Private Sub cmdCreateTask_Click()

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Object
Dim myItem As Object
Dim objSafeTaskItem As Redemption.SafeTaskItem
Dim myNS As NameSpace
Dim timeX As String
Dim strVia As String
Dim strReg As String

On Error Resume Next

Set objOL = GetObject(, "Outlook.Application")

'If outlook is not running, then
If objOL Is Nothing Then

Set objOL = CreateObject("Outlook.Application")
Set myNS = objOL.GetNamespace("MAPI")
myNS.Logon

End If

On Error GoTo 0

' Set up Outlook Objects.
' If there is a date set
If Len(Me!ChaseDateCalendar & "") 0 Then

Set myItem = objOL.CreateItem(olTaskItem) 'Outlook Task
Item
Set objSafeTaskItem = CreateObject("Redemption.safeTaskItem")

objSafeTaskItem.Item = myItem

With objSafeTaskItem

.Subject = Format(Me!ChaseDate, "dd-mmm-yy") & " ChaseUp " &
Trim(Me![FirstName]) & " " & _
Trim(Me![Surname]) & " " & "Via: " & Trim(strVia) & " " & _
" " & Trim(Me![cmbRegarding]) & " " &
Trim(Me![txtAddedNote])
Me!Memo = Me!Memo & vbCrLf & .Subject
.Body = "Add any comments about this chaseup into DATABASE -
not
here"
.ReminderSet = True
'Remind at 9AM
.ReminderTime = FormatDateTime(timeX, 4)
'Due at selected date
.DueDate = Format(Me!ChaseDate, "dd-mmm-yy")
.ReminderPlaySound = True
'Modify path.
'.ReminderSoundFile = "C:\WINNT\Media\Ding.wav"
.Save

End With

Else

MsgBox "No ChaseUp Date set?"

End If

Exit_cmdCreateTask_Click:
Set objSafeTaskItem = Nothing
Set objOL = Nothing
Exit Sub

Err_cmdCreateTask_Click:

MsgBox Err.Description
Resume Exit_cmdCreateTask_Click

End Sub



  #7  
Old June 7th 06, 05:33 PM posted to microsoft.public.outlook.program_vba
Blogd_Node
external usenet poster
 
Posts: 7
Default Adding an Outlook task from Access

Many thanks Sue and Michael,

Got it working OK now.

Code follows for future use of someone else...
---------------------------------------------------------
Private Sub cmdCreateTask_Click()

'JUN2006
'OUTLOOK ACCESS TASK REDEMPTION TASKITEM
'BachAndByte

On Error GoTo Err_cmdCreateTask_Click

Dim objOL As Object
Dim myItem As Object
Dim objSafeTaskItem As Object
Dim myNS As NameSpace
Dim blnOlRunning As Boolean
Dim timeX As String
Dim strVia As String
Dim strReg As String

On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")

'If outlook is not running, then
If objOL Is Nothing Then

Set objOL = CreateObject("Outlook.Application")
Set myNS = objOL.GetNamespace("MAPI")
myNS.Logon

End If

On Error GoTo 0

' Set up Outlook Objects.
' If there is a date set
If Len(Me!ChaseDateCalendar & "") 0 Then

'Set alert time
timeX = "09:00:00"
strVia = Trim(Me![cmbContactBy]) & ""

Select Case Me!cmbContactBy
Case "Home Ph"
If Len(Me![Hm Phone]) 0 Then
strVia = Me![Hm Phone]
Else
MsgBox "No Home Phone ?"
Exit Sub
End If

Case "Work Ph"
If Len(Me![Wk Phone]) 0 Then
strVia = Me![Wk Phone]
Else
MsgBox "No WORK Phone ?"
Exit Sub
End If

Case "Mobile Ph"
If Len(Me![Mob Phone]) 0 Then
strVia = Me![Mob Phone]
Else
MsgBox "No MOBILE Phone ?"
Exit Sub
End If

Case "Email"
If Len(Me![E Mail address]) 0 Then
strVia = "EMAIL"
Else
MsgBox "No EMAIL ?"
Exit Sub
End If

End Select

'check CONTACT VIA combo
If Len(strVia & "") = 0 Then
MsgBox "No Contact Via set ?"
Me!cmbContactBy.SetFocus
Exit Sub
End If

If DateDiff("d", Now, Me!ChaseDate) 0 Then
MsgBox "Invalid date !" & vbCrLf & "Before Today !"
Exit Sub
End If

Set objSafeTaskItem = CreateObject("Redemption.safeTaskItem")
Set myItem = objOL.CreateItem(3) 'Outlook Task Item

objSafeTaskItem.Item = myItem

With objSafeTaskItem

.Subject = Format(Me!ChaseDate, "dd-mmm-yy") & " ChaseUp " &
Trim(Me![FirstName]) & " " & _
Trim(Me![Surname]) & " " & "Via: " & Trim(strVia) & " " & _
" " & Trim(Me![cmbRegarding]) & " " & Trim(Me![txtAddedNote])

If Len(Me![Memo] & "") 0 Then
Me!Memo = Me!Memo & vbCrLf & .Subject
Else
Me!Memo = .Subject
End If

.Body = "Add any comments about this chaseup into DATABASE - not
here"
.ReminderSet = True
'Remind at 9AM
.ReminderTime = FormatDateTime(timeX, 4)
'Due at selected date
.DueDate = Format(Me!ChaseDate, "dd-mmm-yy")
.ReminderPlaySound = True
'Modify path.
.ReminderSoundFile = "C:\WINNT\Media\Ding.wav"
.Save

End With
Me.Refresh

Set myItem = Nothing
Set objSafeTaskItem = Nothing
Set objOL = Nothing

Else

MsgBox "No ChaseUp Date set?"

End If

Exit_cmdCreateTask_Click:

Set myItem = Nothing
Set objSafeTaskItem = Nothing
Set objOL = Nothing
Exit Sub

Err_cmdCreateTask_Click:

MsgBox Err.Description
Resume Exit_cmdCreateTask_Click

End Sub
============================================
"Sue Mosher [MVP-Outlook]" wrote

Try:

Set myItem =Nothing

Bottom line is that you need to dereference every Outlook object you use.

Also, if your code started Outlook, then you'll need to shut down Outlook,
too, with an objOL.Quit statement.

--
===============================================
No -
That now fails with "Automation error"
at line
Set objSafeTaskItem.Item=Nothing

??

===============================================


"Michael Bauer" wrote

I think you need to clean up one more ref at the end:

Set objSafeTaskItem = Nothing
Set objOL = Nothing


Should be:

Set objSafeTaskItem.Item=Nothing
Set objSafeTaskItem=Nothing

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi Michael,

Thanks for the reply.

No error messages from Access code.
First time through, code works OK.
Second time, Outlook stops dead with
a request to send an error report to MS.
When Outlook opens, it pops another message box
"The data file 'Personal Folders' was not closed properly.
The file is being checked for further problems."

Any thoughts ?

Regards

David
============================================
"Michael Bauer" wrote

Where do you get which error?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.vbOffice.net --


Hi,

Config is XP SP2 / Access 2003 / Outlook 2003
Access Refs are VBA / Access 11 / SafeOutlook / DAO 3.6 / Outlook 11 /
Calendar 11

I want to add an Outlook Task from Access.
The problem is Outlook crashes (sometimes) if not open.

Any thoughts about where I'm going wrong ?
( I know just enough VB code to be a danger to myself... )
:-)

Many thanks...

David

(Some Access code below has been snipped for clarity...)




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I access a shared calendar in web access SkyEyes Outlook - Calandaring 3 June 26th 06 01:26 PM
Adding User Defined Field to Task Form Gordon Staley Outlook - Using Forms 4 May 2nd 06 09:24 PM
show all recurrences of a task in the task list dash Outlook - Calandaring 2 April 15th 06 03:45 AM
How do I drag a task in task list of Outlook. It will not let me. rpetralia Outlook - Calandaring 2 April 5th 06 11:14 AM
Link a task to another task gary Outlook and VBA 1 January 10th 06 05:21 PM


All times are GMT +1. The time now is 03:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.