View Single Post
  #4  
Old July 22nd 09, 02:59 PM posted to microsoft.public.outlook.program_vba
Alan Moseley
external usenet poster
 
Posts: 61
Default Move email using the Close event

At which line of code does the process fail? Have you tried stepping it
though?

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"Vasil Vasilev" wrote:

Hi Alan,

thanks for the answer.
Unfortunatelly the problem still persists. No change...


"Alan Moseley" wrote:

You are creating a separate process for your myApp object, which you don't
need and will cause problems. Your code doesn't actaully use the myApp
object anywhere so you don't need any of them, but if other areas of your
code do make use of them then change :-

Dim myApp As New Outlook.Application
to
Dim myApp As Outlook.Application

next change

Set myApp = CreateObject("Outlook.Application")
to
set myApp = Outlook

Lastly change

Set objNS = GetNamespace("MAPI")
to
Set objNS = Outlook.GetNamespace("MAPI")
or
Set objNS = myApp.GetNamespace("MAPI")

Does this prevent the problem?

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


Ads