Problem with VBA statement in Outlook

  • Thread starter Steven M (remove dust to reply)
  • Start date
S

Steven M (remove dust to reply)

I'm trying to write some code that will help me keep track of files
that have been sent to me as attachments (Outlook 2000).

There is a piece of code I found on line, and I was confident that I
could modify it to do as I wanted. However, it keeps stopping on one
line.

Here's what I have so far. It is based on a routine at this page:

http://www.fontstuff.com/outlook/oltut01.htm

The way I often write code is, I write the comments describing how the
program should work. Then I write the code in between.

===========

Sub SummarizeAttachments()

' This Outlook macro checks the current Outlook folder for messages
' with attached files (of any type) and saves a summary to disk.

On Error GoTo SummarizeAttachments_err
' Declare variables
Dim ns As NameSpace
Dim thisFolder As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Set ns = GetNamespace("MAPI")

' The next line is from the web site mentioned above.

Set thisFolder = ns.GetDefaultFolder(olFolderInbox)

' It executes without error. But it's not what I want.
' Instead, I want this:

Set thisFolder = ns.CurrentFolder

' But this line crashes every time. Why?




--
Steve M - (e-mail address removed) (remove dirt for reply)

"Even the Umpire is bound by forces of balance and proportion
which he does not see. The inches he squeezes from the strike
zone when you are a petulant rookie on the mound are returned to
you in full measure in the late innings of your no-hitter." -St.
"Peewee" Augustine in _Letter to a Young Hurler_
 
S

Sue Mosher [MVP]

Because the Namespace object has no child CurrentFolder object. (The object
browser is your friend.) The currently displayed folder is
Application.ActiveExplorer.CurrentFolder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top