When you play around with outlook macros to send mails, get mail data, etc, You will face an issue whether the end user has not opened the outlook.
If the outlook is not open when you run the code, you cannot get the desired results and your code will stop.
I made a simple code to check if the outlook is open while you run the code.
This can be used from Both Excel or Acces.
Sub CheckOutlookIsOpen()
Dim oOutlook As Object
On Error Resume Next
Set oOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
If oOutlook Is Nothing Then
MsgBox "Error : Outlook is not open! This cannot be run without opening outlook", vbCritical, "Error"
End
End If
End Sub
If the outlook is not open when you run the code, you cannot get the desired results and your code will stop.
I made a simple code to check if the outlook is open while you run the code.
This can be used from Both Excel or Acces.
Sub CheckOutlookIsOpen()
Dim oOutlook As Object
On Error Resume Next
Set oOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
If oOutlook Is Nothing Then
MsgBox "Error : Outlook is not open! This cannot be run without opening outlook", vbCritical, "Error"
End
End If
End Sub
No comments:
Post a Comment