macro ist just worling wenn vba editor is open!

  • Thread starter sasan sepahbodi
  • Start date Views 2,114
S

sasan sepahbodi

Hi every one,

i have a problem. My macro is working excellent, but just when vba editor

was opened one time!. Why taht?

Scenery:

Outlook 2003

Win 2003

___

Private Sub Application_NewMail()

'MsgBox "NewMail"

Dim outlookNameSpace As Outlook.NameSpace

Dim inbox As Outlook.MAPIFolder

Dim items As Outlook.items

Dim mail As Outlook.MailItem

Set outlookNameSpace = Me.GetNamespace("MAPI")

Set inbox = outlookNameSpace.GetDefaultFolder(olFolderInbox)

Set items = inbox.items

items.Restrict ("[Unread] = true")

For Each mail In items

'MsgBox "For each NewMail"

Next

End Sub

Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)

mailCopy

'MsgBox "NewMailEx"

End Sub

TanX

Sani
 
J

Jan Hyde

"sasan sepahbodi" <sasan.sepahbodi@ebnerstolz.de>'s wild

thoughts were released on Thu, 16 Apr 2009 14:47:22 +0200

bearing the following fruit:


> Hi every one,

> i have a problem. My macro is working excellent, but just when vba editor
> was opened one time!. Why taht?
>


Try asking your question again. I have no idea what the

problem is that you are having.

J



> Scenery:

> Outlook 2003

> Win 2003

> ___

> Private Sub Application_NewMail()
> 'MsgBox "NewMail"

> Dim outlookNameSpace As Outlook.NameSpace
> Dim inbox As Outlook.MAPIFolder
> Dim items As Outlook.items
> Dim mail As Outlook.MailItem

> Set outlookNameSpace = Me.GetNamespace("MAPI")
> Set inbox = outlookNameSpace.GetDefaultFolder(olFolderInbox)
> Set items = inbox.items

> items.Restrict ("[Unread] = true")

> For Each mail In items
> 'MsgBox "For each NewMail"
> Next

> End Sub

> Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)

> mailCopy
> 'MsgBox "NewMailEx"

> End Sub

> TanX

> Sani
>


Jan Hyde
 

Top