macro ist just worling wenn vba editor is open!

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" <[email protected]>'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
 

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