 |
|
|
|
| Author |
Message |
"Werner_Faßbender
Joined: 09 Jan 2008 Posts: 11
|
Posted: Sun Jan 27, 2008 3:17 pm Post subject: Outlook.exe can't close it |
|
|
Hello,
I'm using OL2003, AC97, WinXP
I can't close Outllok.exe.
To make a copy of the Outlook.pst I'm using this code.
But after this code outlook.exe is still running.
How can I close it?
-------------------------------------------------------------------------------
Dim myolApp As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Set myolApp = CreateObject("Outlook.Application")
Set myNameSpace = myolApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts)
getPSTPath = GetPathFromStoreID(myFolder.StoreID)
routine_exit:
myolApp.Quit
If Not myFolder Is Nothing Then Set myFolder = Nothing
If Not myNameSpace Is Nothing Then Set myNameSpace = Nothing
If Not myolApp Is Nothing Then Set myolApp = Nothing
------------------------------------------------------------------------------------
Thanks a lot
best regards
Werner
Archived from group: microsoft>public>office>developer>outlook>vba |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Sun Jan 27, 2008 9:17 pm Post subject: Re: Outlook.exe can't close it |
|
|
Try releasing the NameSpace and MAPIFolder objects first before calling
..Quit
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Werner Faßbender" wrote in message @u10g2000prn.googlegroups.com...
> Hello,
>
> I'm using OL2003, AC97, WinXP
>
> I can't close Outllok.exe.
> To make a copy of the Outlook.pst I'm using this code.
> But after this code outlook.exe is still running.
> How can I close it?
>
> -------------------------------------------------------------------------------
> Dim myolApp As Outlook.Application
> Dim myNameSpace As Outlook.NameSpace
> Dim myFolder As Outlook.MAPIFolder
>
> Set myolApp = CreateObject("Outlook.Application")
> Set myNameSpace = myolApp.GetNamespace("MAPI")
> Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts)
>
> getPSTPath = GetPathFromStoreID(myFolder.StoreID)
>
> routine_exit:
> myolApp.Quit
> If Not myFolder Is Nothing Then Set myFolder = Nothing
> If Not myNameSpace Is Nothing Then Set myNameSpace = Nothing
> If Not myolApp Is Nothing Then Set myolApp = Nothing
> ------------------------------------------------------------------------------------
>
>
> Thanks a lot
> best regards
> Werner
> |
|
| Back to top |
|
 |
"Werner_Faßbender
Joined: 09 Jan 2008 Posts: 11
|
Posted: Sun Jan 27, 2008 10:55 pm Post subject: Re: Outlook.exe can't close it |
|
|
> Try releasing the NameSpace and MAPIFolder objects first before calling
> .Quit
>
OK I've done that.
Outlook.exe is not longer visible in the taskmanager.
But the FileCopy of the Outlook.pst fires error 70, same as before.
'** 1. this works:
strUserPfad = Environ("USERPROFILE")
strUserPfad = strUserPfad & "\Lokale Einstellungen\Anwendungsdaten
\Microsoft\Outlook\"
strUserPfad_Appl = strUserPfad & "Outlook.pst"
----------------------------------------------------------------------
'** 2. this doesn't works:
strUserPfad_Appl = Trim(getPSTPath) ' code see above
----------------------------------------------------------------------
when I substitute the path by a constant string (1) it works.
when I determine the path by this methode (2) something blocked
the outlook.pst file.
thanks a lot
Werner |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Mon Jan 28, 2008 3:34 pm Post subject: Re: Outlook.exe can't close it |
|
|
I have no idea what your getPSTPath method is or does so I have no idea how
it works and why it's not working for you as expected. Your previous post
didn't mention anything about any error 70. What results are you getting
from that method as opposed to your #1 method?
Outlook will also lock a PST file for a period of time after Outlook closes,
you have to account for that.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Werner Faßbender" wrote in message @s12g2000prg.googlegroups.com...
>> Try releasing the NameSpace and MAPIFolder objects first before calling
>> .Quit
>>
>
> OK I've done that.
>
> Outlook.exe is not longer visible in the taskmanager.
> But the FileCopy of the Outlook.pst fires error 70, same as before.
>
> '** 1. this works:
> strUserPfad = Environ("USERPROFILE")
> strUserPfad = strUserPfad & "\Lokale Einstellungen\Anwendungsdaten
> \Microsoft\Outlook\"
> strUserPfad_Appl = strUserPfad & "Outlook.pst"
>
> ----------------------------------------------------------------------
>
> '** 2. this doesn't works:
> strUserPfad_Appl = Trim(getPSTPath) ' code see above
>
> ----------------------------------------------------------------------
>
> when I substitute the path by a constant string (1) it works.
> when I determine the path by this methode (2) something blocked
> the outlook.pst file.
>
> thanks a lot
> Werner
>
> |
|
| Back to top |
|
 |
"Werner_Faßbender
Joined: 09 Jan 2008 Posts: 11
|
Posted: Mon Jan 28, 2008 8:09 pm Post subject: Re: Outlook.exe can't close it |
|
|
> I have no idea what your getPSTPath method is or does so I have no
> idea
how
> it works and why it's not working for you as expected. Your previous
> post didn't mention anything about any error 70. What results are you
> getting from that method as opposed to your #1 method?
Sorry for my inconvenience.
Here is what the function does:
---------------------------------------------------------------------
Function dasiOutlook() As Boolean
Dim strUserPfad As String
Dim strUserPfad_Appl As String
Dim strNow As String
On Error GoTo routine_err
dasiOutlook = False
strUserPfad_Appl = Trim(getPSTPath) '*************** see the
following function ***************
If Len(Dir(strUserPfad_Appl)) > 0 Then
strNow = replace_telefon(Now())
FileCopy strUserPfad_Appl, strUserPfad_Appl & "_" & strNow
'*************** Error 70 occurs ***************
dasiOutlook = True
Else
MsgBox "Datei Outlook.pst nicht gefunden. Sicherungskopie von
Outlook kann nicht erstellt werden." & vbLf & vbLf & _
"Synchronisation RAMIGOS --> OUTLOOK wird nicht
durchgeführt." & vbLf & vbLf & _
strUserPfad_Appl
End If
routine_exit:
Exit Function
routine_err:
Select Case Err
Case 70 'Access denied
MsgBox "A backup copy of the outlook.pst can't be
make."
Call SubWriteLog("dasiOutlook", Err.Number & " "
& Err.Description & " " & Application.CurrentObjectName)
Resume routine_exit
Case Else
MsgBox Err & " " & Err.Description & " " &
Application.CurrentObjectName
Call SubWriteLog("dasiOutlook", Err.Number & " " &
Err.Description & " " & Application.CurrentObjectName)
Resume routine_exit
End Select
End Function
----------------------------------------------------------------------------
------
----------------------------------------------------------------------------
------
Public Function getPSTPath() As String
Dim myolApp As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
On Error GoTo routine_err
Set myolApp = CreateObject("Outlook.Application")
Set myNameSpace = myolApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts)
getPSTPath = GetPathFromStoreID(myFolder.StoreID)
routine_exit:
If Not myFolder Is Nothing Then Set myFolder = Nothing
If Not myNameSpace Is Nothing Then Set myNameSpace = Nothing
myolApp.Quit
If Not myolApp Is Nothing Then Set myolApp = Nothing
Exit Function
routine_err:
Select Case Err
Case Else
MsgBox Err & " " & Err.Description & " " &
Application.CurrentObjectName
Call SubWriteLog("fncReSo", Err.Number & " " &
Err.Description & " " & Application.CurrentObjectName)
Resume routine_exit
End Select
----------------------------------------------------------------------------
-----
>>What results are you getting
>>from that method as opposed to your #1 method?
This command fires Err 70 = "Access denied"
FileCopy strUserPfad_Appl, strUserPfad_Appl & "_" & strNow
'*************** Error 70 occurs ***************
Thanks a lot
and best regards
Werner |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Mon Jan 28, 2008 11:32 pm Post subject: Re: Outlook.exe can't close it |
|
|
OK, you're keeping me guessing. What's the code for GetPathFromStoreID()?
Have you compared what you get back from method 1 and method 2? Are they the
same?
For the method where you hard code the path are you using any Outlook object
model code? If not then are you accounting for the time that the PST file
will remain locked after you call Quit on the Outlook.Application object?
Try waiting a few minutes.
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Werner Faßbender" wrote in message @i72g2000hsd.googlegroups.com...
> I have no idea what your getPSTPath method is or does so I have no
> idea
how
> it works and why it's not working for you as expected. Your previous
> post didn't mention anything about any error 70. What results are you
> getting from that method as opposed to your #1 method?
Sorry for my inconvenience.
Here is what the function does:
---------------------------------------------------------------------
Function dasiOutlook() As Boolean
Dim strUserPfad As String
Dim strUserPfad_Appl As String
Dim strNow As String
On Error GoTo routine_err
dasiOutlook = False
strUserPfad_Appl = Trim(getPSTPath) '*************** see the
following function ***************
If Len(Dir(strUserPfad_Appl)) > 0 Then
strNow = replace_telefon(Now())
FileCopy strUserPfad_Appl, strUserPfad_Appl & "_" & strNow
'*************** Error 70 occurs ***************
dasiOutlook = True
Else
MsgBox "Datei Outlook.pst nicht gefunden. Sicherungskopie von
Outlook kann nicht erstellt werden." & vbLf & vbLf & _
"Synchronisation RAMIGOS --> OUTLOOK wird nicht
durchgeführt." & vbLf & vbLf & _
strUserPfad_Appl
End If
routine_exit:
Exit Function
routine_err:
Select Case Err
Case 70 'Access denied
MsgBox "A backup copy of the outlook.pst can't be
make."
Call SubWriteLog("dasiOutlook", Err.Number & " "
& Err.Description & " " & Application.CurrentObjectName)
Resume routine_exit
Case Else
MsgBox Err & " " & Err.Description & " " &
Application.CurrentObjectName
Call SubWriteLog("dasiOutlook", Err.Number & " " &
Err.Description & " " & Application.CurrentObjectName)
Resume routine_exit
End Select
End Function
----------------------------------------------------------------------------
------
----------------------------------------------------------------------------
------
Public Function getPSTPath() As String
Dim myolApp As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
On Error GoTo routine_err
Set myolApp = CreateObject("Outlook.Application")
Set myNameSpace = myolApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderContacts)
getPSTPath = GetPathFromStoreID(myFolder.StoreID)
routine_exit:
If Not myFolder Is Nothing Then Set myFolder = Nothing
If Not myNameSpace Is Nothing Then Set myNameSpace = Nothing
myolApp.Quit
If Not myolApp Is Nothing Then Set myolApp = Nothing
Exit Function
routine_err:
Select Case Err
Case Else
MsgBox Err & " " & Err.Description & " " &
Application.CurrentObjectName
Call SubWriteLog("fncReSo", Err.Number & " " &
Err.Description & " " & Application.CurrentObjectName)
Resume routine_exit
End Select
----------------------------------------------------------------------------
-----
>>What results are you getting
>>from that method as opposed to your #1 method?
This command fires Err 70 = "Access denied"
FileCopy strUserPfad_Appl, strUserPfad_Appl & "_" & strNow
'*************** Error 70 occurs ***************
Thanks a lot
and best regards
Werner |
|
| Back to top |
|
 |
"Werner_Faßbender
Joined: 09 Jan 2008 Posts: 11
|
Posted: Tue Jan 29, 2008 5:02 am Post subject: Re: Outlook.exe can't close it |
|
|
On 29 Jan., 00:32, "Ken Slovak - [MVP - Outlook]"
wrote:
> OK, you're keeping me guessing. What's the code for GetPathFromStoreID()?
>
Public Function GetPathFromStoreID(sStoreID As String) As String
'Entslüsselt den Pfad zur PST Datei
Dim I As Long
Dim lPos As Long
Dim sRes As String
On Error Resume Next
For I = 1 To Len(sStoreID) Step 2
sRes = sRes & Chr("&h" & Mid$(sStoreID, I, 2))
Next
'sRes = Replace(sRes, Chr(0), vbNullString)
lPos = InStr(sRes, ":\")
If lPos Then
GetPathFromStoreID = Right$(sRes, (Len(sRes)) - (lPos - 2))
End If
End Function
-----------------------------------------------------------------------------
> Have you compared what you get back from method 1 and method 2? Are they the
> same?
>
methode 1 with the hard coded path is working well.
> For the method where you hard code the path are you using any Outlook object
> model code?
No I diden't use the outlook object model for the hard coded path
>If not then are you accounting for the time that the PST file
> will remain locked after you call Quit on the Outlook.Application object?
> Try waiting a few minutes.
>
wait 5 Minutes error 70 still going on
Best regards
werner |
|
| Back to top |
|
 |
Ken Slovak - [MVP - Outlo
Joined: 12 Aug 2007 Posts: 405
|
Posted: Tue Jan 29, 2008 3:49 pm Post subject: Re: Outlook.exe can't close it |
|
|
Did you compare the results from method 1 and 2 to see if they are
identical? If they are identical are you sure that outlook.exe is not still
listed in the Processes tab of the Task Manager? Are you holding any Outlook
objects open?
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Werner Faßbender" wrote in message @q39g2000hsf.googlegroups.com...
On 29 Jan., 00:32, "Ken Slovak - [MVP - Outlook]"
wrote:
> OK, you're keeping me guessing. What's the code for GetPathFromStoreID()?
>
Public Function GetPathFromStoreID(sStoreID As String) As String
'Entslüsselt den Pfad zur PST Datei
Dim I As Long
Dim lPos As Long
Dim sRes As String
On Error Resume Next
For I = 1 To Len(sStoreID) Step 2
sRes = sRes & Chr("&h" & Mid$(sStoreID, I, 2))
Next
'sRes = Replace(sRes, Chr(0), vbNullString)
lPos = InStr(sRes, ":\")
If lPos Then
GetPathFromStoreID = Right$(sRes, (Len(sRes)) - (lPos - 2))
End If
End Function
-----------------------------------------------------------------------------
> Have you compared what you get back from method 1 and method 2? Are they
> the
> same?
>
methode 1 with the hard coded path is working well.
> For the method where you hard code the path are you using any Outlook
> object
> model code?
No I diden't use the outlook object model for the hard coded path
>If not then are you accounting for the time that the PST file
> will remain locked after you call Quit on the Outlook.Application object?
> Try waiting a few minutes.
>
wait 5 Minutes error 70 still going on
Best regards
werner
|
|
| Back to top |
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|