![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as
follows: Dim objOutlook As Outlook.Application Set objOutlook = CreateObject("Outlook.Application") etc.... The code works fine except when the Exchange Server is unavailable (Popup message Your Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel) Is it possible, programmatically (VB or VBA), to check the availability of the Exchange Server before using Outlook features ? Thanks a lot. Regards. Jean-Luc |
#2
|
|||
|
|||
![]()
Try checking the value of NameSpace.ExchangeConnectionMode. You should
always be able to retrieve a valid Outlook.Application object though, regardless of what it is trying to connect to or it's connection state. You didn't show all of your code so I don't know exactly what you are trying to do or when. -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "jeanLuc" wrote: I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as follows: Dim objOutlook As Outlook.Application Set objOutlook = CreateObject("Outlook.Application") etc.... The code works fine except when the Exchange Server is unavailable (Popup message Your Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel) Is it possible, programmatically (VB or VBA), to check the availability of the Exchange Server before using Outlook features ? Thanks a lot. Regards. Jean-Luc |
#3
|
|||
|
|||
![]()
Thanks. I will try this and watch the behaviour of my scheduled job.
Rgrds JL "Eric Legault [MVP - Outlook]" wrote: Try checking the value of NameSpace.ExchangeConnectionMode. You should always be able to retrieve a valid Outlook.Application object though, regardless of what it is trying to connect to or it's connection state. You didn't show all of your code so I don't know exactly what you are trying to do or when. -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "jeanLuc" wrote: I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as follows: Dim objOutlook As Outlook.Application Set objOutlook = CreateObject("Outlook.Application") etc.... The code works fine except when the Exchange Server is unavailable (Popup message Your Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel) Is it possible, programmatically (VB or VBA), to check the availability of the Exchange Server before using Outlook features ? Thanks a lot. Regards. Jean-Luc |
#4
|
|||
|
|||
![]()
Again me. I have tested around some solutions but I always have my problem.
Here the beginning of the code : Set myOlApp = CreateObject("Outlook.Application") ' line 1 Set myNamespace = myOlApp.GetNamespace("MAPI") ' line 2 Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox) ' line 3 When the program comes to the line 3, it brings me the popup Your Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel (wenn answering Retry to this popup, the program continue normally and connect to Exchange) I have inserted between line 2 and 3 following code, in order to give time to the process to connect to exchange (stupid idea, perhaps ?) : Open gsLogFile For Append As #1 nb_retry = 1 While myNamespace.ExchangeConnectionMode = olNoExchange _ Or myNamespace.ExchangeConnectionMode = olDisconnected _ Or myNamespace.ExchangeConnectionMode = olCachedDisconnected PauseTime = 60 Start = Timer Do While Timer Start + PauseTime DoEvents Loop Print #1, "Dump " & myNamespace.ExchangeConnectionMode & " - check " & nb_retry & " - " & Now nb_retry = nb_retry + 1 If nb_retry 60 Then GoTo end_main End If Wend Close #1 Result : I always got 60 lines of dump in my logfile. myNamespace.ExchangeConnectionMode never got another value then 0. And it jump to the end of the program. Any other idea, perhaps ? Thanks and regards. Jean-Luc ********** "jeanLuc" wrote: Thanks. I will try this and watch the behaviour of my scheduled job. Rgrds JL "Eric Legault [MVP - Outlook]" wrote: Try checking the value of NameSpace.ExchangeConnectionMode. You should always be able to retrieve a valid Outlook.Application object though, regardless of what it is trying to connect to or it's connection state. You didn't show all of your code so I don't know exactly what you are trying to do or when. -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "jeanLuc" wrote: I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as follows: Dim objOutlook As Outlook.Application Set objOutlook = CreateObject("Outlook.Application") etc.... The code works fine except when the Exchange Server is unavailable (Popup message Your Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel) Is it possible, programmatically (VB or VBA), to check the availability of the Exchange Server before using Outlook features ? Thanks a lot. Regards. Jean-Luc |
#5
|
|||
|
|||
![]()
You mentioned you were running this code as part of a scheduled job - that's
the problem: The Outlook Object Model is unsuitable to run in a Windows service: http://support.microsoft.com/default...b;en-us;237913 -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "jeanLuc" wrote: Again me. I have tested around some solutions but I always have my problem. Here the beginning of the code : Set myOlApp = CreateObject("Outlook.Application") ' line 1 Set myNamespace = myOlApp.GetNamespace("MAPI") ' line 2 Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox) ' line 3 When the program comes to the line 3, it brings me the popup Your Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel (wenn answering Retry to this popup, the program continue normally and connect to Exchange) I have inserted between line 2 and 3 following code, in order to give time to the process to connect to exchange (stupid idea, perhaps ?) : Open gsLogFile For Append As #1 nb_retry = 1 While myNamespace.ExchangeConnectionMode = olNoExchange _ Or myNamespace.ExchangeConnectionMode = olDisconnected _ Or myNamespace.ExchangeConnectionMode = olCachedDisconnected PauseTime = 60 Start = Timer Do While Timer Start + PauseTime DoEvents Loop Print #1, "Dump " & myNamespace.ExchangeConnectionMode & " - check " & nb_retry & " - " & Now nb_retry = nb_retry + 1 If nb_retry 60 Then GoTo end_main End If Wend Close #1 Result : I always got 60 lines of dump in my logfile. myNamespace.ExchangeConnectionMode never got another value then 0. And it jump to the end of the program. Any other idea, perhaps ? Thanks and regards. Jean-Luc ********** "jeanLuc" wrote: Thanks. I will try this and watch the behaviour of my scheduled job. Rgrds JL "Eric Legault [MVP - Outlook]" wrote: Try checking the value of NameSpace.ExchangeConnectionMode. You should always be able to retrieve a valid Outlook.Application object though, regardless of what it is trying to connect to or it's connection state. You didn't show all of your code so I don't know exactly what you are trying to do or when. -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "jeanLuc" wrote: I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as follows: Dim objOutlook As Outlook.Application Set objOutlook = CreateObject("Outlook.Application") etc.... The code works fine except when the Exchange Server is unavailable (Popup message Your Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel) Is it possible, programmatically (VB or VBA), to check the availability of the Exchange Server before using Outlook features ? Thanks a lot. Regards. Jean-Luc |
#6
|
|||
|
|||
![]()
OK. Thanks.
Jean-Luc "Eric Legault [MVP - Outlook]" wrote: You mentioned you were running this code as part of a scheduled job - that's the problem: The Outlook Object Model is unsuitable to run in a Windows service: http://support.microsoft.com/default...b;en-us;237913 -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "jeanLuc" wrote: Again me. I have tested around some solutions but I always have my problem. Here the beginning of the code : Set myOlApp = CreateObject("Outlook.Application") ' line 1 Set myNamespace = myOlApp.GetNamespace("MAPI") ' line 2 Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox) ' line 3 When the program comes to the line 3, it brings me the popup Your Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel (wenn answering Retry to this popup, the program continue normally and connect to Exchange) I have inserted between line 2 and 3 following code, in order to give time to the process to connect to exchange (stupid idea, perhaps ?) : Open gsLogFile For Append As #1 nb_retry = 1 While myNamespace.ExchangeConnectionMode = olNoExchange _ Or myNamespace.ExchangeConnectionMode = olDisconnected _ Or myNamespace.ExchangeConnectionMode = olCachedDisconnected PauseTime = 60 Start = Timer Do While Timer Start + PauseTime DoEvents Loop Print #1, "Dump " & myNamespace.ExchangeConnectionMode & " - check " & nb_retry & " - " & Now nb_retry = nb_retry + 1 If nb_retry 60 Then GoTo end_main End If Wend Close #1 Result : I always got 60 lines of dump in my logfile. myNamespace.ExchangeConnectionMode never got another value then 0. And it jump to the end of the program. Any other idea, perhaps ? Thanks and regards. Jean-Luc ********** "jeanLuc" wrote: Thanks. I will try this and watch the behaviour of my scheduled job. Rgrds JL "Eric Legault [MVP - Outlook]" wrote: Try checking the value of NameSpace.ExchangeConnectionMode. You should always be able to retrieve a valid Outlook.Application object though, regardless of what it is trying to connect to or it's connection state. You didn't show all of your code so I don't know exactly what you are trying to do or when. -- Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration) Try Picture Attachments Wizard for Outlook: http://www.collaborativeinnovations.ca Blog: http://blogs.officezealot.com/legault/ "jeanLuc" wrote: I have some code I use to handle mail messages (Outlook 2003) with VB/VBA as follows: Dim objOutlook As Outlook.Application Set objOutlook = CreateObject("Outlook.Application") etc.... The code works fine except when the Exchange Server is unavailable (Popup message Your Microsoft Exchange Server is unavailable / Retry - Work Offline - Cancel) Is it possible, programmatically (VB or VBA), to check the availability of the Exchange Server before using Outlook features ? Thanks a lot. Regards. Jean-Luc |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Exchange Server | Ian | Outlook - Installation | 1 | October 17th 06 04:30 AM |
Multiple email recipients with Shared Fax Server on Server 2003/Exchange 2003 | [email protected] | Outlook - Fax Functions | 2 | October 10th 06 01:11 AM |
Cannot connect to Exchange server from Outlook client on Windows 2003 Server | AllenM | Outlook - General Queries | 0 | May 16th 06 07:44 PM |
!!HELP!!! Cannot connect to Exchange Server from a RDP, ICA session or server local machine | AllenM | Outlook - General Queries | 0 | May 11th 06 11:14 PM |
how to get Exchange server? | [email protected] | Outlook and VBA | 5 | February 8th 06 06:37 PM |