Outlook VBA error
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Outlook VBA error
I have a few Outlook macros, and one of them occasionally throws up this dialog box.
I don't know which macro is doing this, and the dialog box doesn't have a "debug" button.
Any suggestions on how to troubleshoot this?
I don't know which macro is doing this, and the dialog box doesn't have a "debug" button.
Any suggestions on how to troubleshoot this?
You do not have the required permissions to view the files attached to this post.
StuartR
-
- Administrator
- Posts: 78446
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Outlook VBA error
I found repeated suggestions to try and create a new e-mail profile in the Mail control panel.
The following MSKB article mentions a very specific possible cause of the error: You receive the error "The attempted operation failed" in Outlook 2010 when you try to retrieve the DisplayType property of an email recipient.
The following MSKB article mentions a very specific possible cause of the error: You receive the error "The attempted operation failed" in Outlook 2010 when you try to retrieve the DisplayType property of an email recipient.
Best wishes,
Hans
Hans
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Outlook VBA error
I can't find DisplayType or .Recipient anywhere in the VBE.
All the code I have loaded came from this lounge or from the Windows Secrets lounge when it had a different name. It includes the code from the following threads.
All the code I have loaded came from this lounge or from the Windows Secrets lounge when it had a different name. It includes the code from the following threads.
StuartR
-
- 3StarLounger
- Posts: 397
- Joined: 24 Jan 2010, 19:43
- Location: Salt Lake City, Utah, USA
Re: Outlook VBA error
Can you create an errorhandler to trap the error type and see what object type is not found? Does the code error when you the Exchange mailbox is not available, or some other routine status is not present?
Is the code is mostly folder navigation?
Is the code is mostly folder navigation?
Goshute
I float in liquid gardens
I float in liquid gardens
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Outlook VBA error
There are quite a lot of separate routines in multiple modules. I am not sure how to create an error handler without editing every routine.
StuartR
-
- Administrator
- Posts: 78446
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Outlook VBA error
The Outlook Attachment Manager works without errors for me in 32-bit Outlook 2010 SP1 and for my boss in 64-bit Outlook 2010 SP1, so hopefully you can exclude that.
Best wishes,
Hans
Hans
-
- PlutoniumLounger
- Posts: 15595
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Outlook VBA error
Assuming that you have control over the VBA code and don''t want to step through it,...StuartR wrote:... and one of them occasionally throws up this dialog box.
What happens if you use Ctrl-Break while that pop-up is showing? Then Choose OK.
A MsgBox, in this situation (Ctrl-Break, then OK) breaks the code at the executable immediately after the MsgBox statement.
I find "Ctrl-Break; OK" a very fast way of locating the region of the source of the offending output.
HTH
There's nothing heavier than an empty water bottle
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Outlook VBA error
I will try this next time it occurs. This may be today, or it may not happen for a week or two. It often happens when Outlook is in the background so it is not associated with any particular Outlook activity that I am carrying out.ChrisGreaves wrote:...
What happens if you use Ctrl-Break while that pop-up is showing? Then Choose OK.
...
StuartR
-
- PlutoniumLounger
- Posts: 15595
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Outlook VBA error
Can you export the modules using e.g. Rob Bovey's CodeCleaner or similar and eye-ball them to see what sort of tasks Outlook might be performing in the background?StuartR wrote: ... All the code I have loaded ...
There's nothing heavier than an empty water bottle
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Outlook VBA error
It happened this morning. I tried control-break but it simply dismissed the dialog box.
I have eyballed the code and I can't see any background tasks. I wonder if it could be something triggered by one of my many inbox rules.
I have eyballed the code and I can't see any background tasks. I wonder if it could be something triggered by one of my many inbox rules.
StuartR
-
- PlutoniumLounger
- Posts: 15595
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Outlook VBA error
I generally rail against "On Error", and now ask :StuartR wrote:I have eyballed the code ...
Are there On Error statements that you can disable by commenting out, to see what, if any, run-time-errors pop up?
And where?
There's nothing heavier than an empty water bottle
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Outlook VBA error
I have three different pieces of code in use (that I can find)..ChrisGreaves wrote:...Are there On Error statements that you can disable by commenting out, to see what, if any, run-time-errors pop up?
And where?
Outlook Attachment Manager has three forms and two modules, with quite a lot of procedures between them. Hans says that this code works fine form him on a few PCs, and I can't see any code that would run except when I actually click on the relevant button.
GoToParallelFolder only runs when I click on the QAT button. It also has just has one procedure
Code: Select all
Sub GoToParallelFolder()
Dim objParent As Object
Dim fldrTargFolder As MAPIFolder
Dim arrFolders() As String
' code string with Exchange root folder name, no slashes
Const strExchPFolder As String = "Mailbox - Lastname, Firstname" ' edited by StuartR to remove my name
' code string with PST root folder name, no slashes
Const strPSTPFolder As String = "Archive"
Dim strStartPFolder As String, strTargPFolder As String, strStartFolderPath As String
Dim intI As Integer
With Outlook.ActiveExplorer
If CBool(InStr(.CurrentFolder.FolderPath, "\\Mailbox ")) Then ' in Exchange Folder
strStartPFolder = strExchPFolder
strTargPFolder = strPSTPFolder
Else ' in PST Folder
strStartPFolder = strPSTPFolder
strTargPFolder = strExchPFolder
End If
strStartFolderPath = .CurrentFolder.Name
Set objParent = .CurrentFolder
Do Until objParent.Parent.Name = strStartPFolder
Set objParent = objParent.Parent
strStartFolderPath = objParent.Name & Chr(19) & strStartFolderPath
Loop
Set objParent = Nothing
arrFolders() = Split(Trim(strStartFolderPath), Chr(19), , vbTextCompare)
Set fldrTargFolder = Outlook.Session.Folders(strTargPFolder)
If UBound(arrFolders) >= 0 Then ' if < 0 root folder currently selected
For intI = 0 To UBound(arrFolders)
On Error GoTo HANDLER:
Set fldrTargFolder = fldrTargFolder.Folders(arrFolders(intI))
Next intI
End If
.SelectFolder fldrTargFolder
End With
HANDLER:
If Err Then MsgBox "Corresponding FolderPath not found in " & strTargPFolder
Set fldrTargFolder = Nothing
End Sub
Code: Select all
Sub GetParentFolder()
Dim strMsg As String
Dim fld As Object
On Error GoTo ErrHandler
If TypeName(ActiveWindow) = "Inspector" Then
Set fld = ActiveInspector.CurrentItem.Parent
On Error Resume Next
Do
strMsg = "\" & fld.Name & strMsg
Set fld = fld.Parent
Loop Until Err
strMsg = "Path: " & Mid(strMsg, 2)
ElseIf TypeName(ActiveWindow) = "Explorer" Then
If ActiveExplorer.Selection.Count > 0 Then
If ActiveExplorer.Selection.Count = 1 Then
Set fld = ActiveExplorer.Selection.Item(1).Parent
On Error Resume Next
Do
strMsg = "\" & fld.Name & strMsg
Set fld = fld.Parent
Loop Until Err
strMsg = "Path: " & Mid(strMsg, 2)
Else
strMsg = "You have selected more than one item."
End If
Else
strMsg = "You haven't selected any items."
End If
End If
ExitHandler:
MsgBox strMsg, vbInformation
Exit Sub
ErrHandler:
Select Case Err
Case 430, -2147467262
strMsg = "Sorry, the macro doesn't work with Advanced Find."
Case Else
strMsg = Err.Description
End Select
Resume ExitHandler
End Sub
StuartR
-
- PlutoniumLounger
- Posts: 15595
- Joined: 24 Jan 2010, 23:23
- Location: brings.slot.perky
Re: Outlook VBA error
Hi Stuart.StuartR wrote:I have three different pieces of code in use (that I can find)..
I see four instances of "On Error".
:straw-clutching: Can you disable those four occurrences? (And any others lurking ...)
From all that I've read, OnError has a habit of biting one in the bum if not done perfectly.
FWIW I try to limit OnError to library utility routines, usually to accomplish something that MS didn't cater for, like the original FileExists, or to determine the number of dimensions of an array (both, I think, now rectified)
There's nothing heavier than an empty water bottle
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Outlook VBA error
I tried leaving a VBE window open, in the hope that I would be able to switch to that and issue a Control-Break, but the error just happened again and I still couldn't cause it to break.
This time I was reading a book, and had not typed anything or moved the mouse for at least 5 minutes.
This time I was reading a book, and had not typed anything or moved the mouse for at least 5 minutes.
StuartR
-
- 3StarLounger
- Posts: 397
- Joined: 24 Jan 2010, 19:43
- Location: Salt Lake City, Utah, USA
Re: Outlook VBA error
Stuart, most of your active macros are user-initiated. Are any of the macros triggered by rules?
Goshute
I float in liquid gardens
I float in liquid gardens
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Outlook VBA error
I think that all of my macros are user initiated. I can't see any that are triggered by rules. I only have the macros that I have identified above.
StuartR
-
- 3StarLounger
- Posts: 397
- Joined: 24 Jan 2010, 19:43
- Location: Salt Lake City, Utah, USA
Re: Outlook VBA error
Though it's most likely the macros, perhaps you have a defective Add-In? You may have to do this the hard way, by disabling VBA subs one by one, and then disabling add-ins one by one until the problem does not arise.
Goshute
I float in liquid gardens
I float in liquid gardens
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Outlook VBA error
That's about what I decided.
I have seen the same error message generated by GoToParallelFolder if the currently selected folder is the root, so I have put a breakpoint on the line in that routine that generated the error - but it hasn't failed for a couple of days now.
I have seen the same error message generated by GoToParallelFolder if the currently selected folder is the root, so I have put a breakpoint on the line in that routine that generated the error - but it hasn't failed for a couple of days now.
StuartR
-
- Administrator
- Posts: 12604
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Outlook VBA error
It just failed again, 3 days between failures makes it hard to try too many things.
It didn't hit my breakpoint, so that's one part of one module that it can't be.
I could disable things one at a time, but this could take a while and leave me without useful functionality for many days. Maybe I will just live with the occasional error.
It didn't hit my breakpoint, so that's one part of one module that it can't be.
I could disable things one at a time, but this could take a while and leave me without useful functionality for many days. Maybe I will just live with the occasional error.
StuartR