chrismc
11-27-2011, 08:30 AM
Hi everyone,
I've been using a couple of macros to automatically send emails with particular details completed for some time and they have worked fine.
A few months back after one of the Windows Updates I started to get additional windows opening up in Outlook although I hadn't actually changed the coding. This isn't a big problem when I'm only sending a couple of emails but some some pieces of work the code works through 200 emails and so creates 400 unwanted Windows.
I use Outlook 2007 with Exchange server.
I've found that the code which triggers the new windows is:
olApp.GetNamespace("MAPI").Folders.GetFirst.GetExplorer.CommandBars.FindControl(, 5613).Execute
I use it once to set Outlook as offline and later to set Outlook as online. I've found it necessary to include this coding to ensure that Outlook delays doing stuff whilst the code is running. I'd checked out quite a few links from VBA Express to find a way to ensure code had time to run and this worked better for me than the application.wait approach.
Simplest solution?
As the windows which open are for folders that are parents of folders that items are being filed into it is possible to predict which windows will appear I suspect that I could add code to close the windows.
Could you please help with with code for:
- close a window using a hard coded window name
- close a window which is the parent of an identifiable folder
- anything better
Thanks in advance
Chris
I've been using a couple of macros to automatically send emails with particular details completed for some time and they have worked fine.
A few months back after one of the Windows Updates I started to get additional windows opening up in Outlook although I hadn't actually changed the coding. This isn't a big problem when I'm only sending a couple of emails but some some pieces of work the code works through 200 emails and so creates 400 unwanted Windows.
I use Outlook 2007 with Exchange server.
I've found that the code which triggers the new windows is:
olApp.GetNamespace("MAPI").Folders.GetFirst.GetExplorer.CommandBars.FindControl(, 5613).Execute
I use it once to set Outlook as offline and later to set Outlook as online. I've found it necessary to include this coding to ensure that Outlook delays doing stuff whilst the code is running. I'd checked out quite a few links from VBA Express to find a way to ensure code had time to run and this worked better for me than the application.wait approach.
Simplest solution?
As the windows which open are for folders that are parents of folders that items are being filed into it is possible to predict which windows will appear I suspect that I could add code to close the windows.
Could you please help with with code for:
- close a window using a hard coded window name
- close a window which is the parent of an identifiable folder
- anything better
Thanks in advance
Chris