• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to use VBA Code to term which email client exist on machine

Hello,

I have an application that needs to email excel documents. A new email client will be rolling out, and some users will be using the old email client which is Lotus Notes, and other users will be using Microsoft Outlooks. I need to write code that will determine which email client is on the machine and runs the proper code for that client. Does anyone know how I can do this without crashing the vba application?

~Regards
 
Are both email clients installed on the user machines irrespective of their working or non-working?
Some user will only have Microsoft Office other user will have Lotus Notes as the email client. Everyone will not have the same email client. The user of application do not have both email clients on their machine.
 
OK. I am assuming at least one of the client will always be there. Here's the basic idea of handling it. Please adjust sub routine names to suit.
Code:
Public Sub MainRoutine()
Dim objNoteSess As Object
'\\ Try to create a new instance of Lotus notes
On Error Resume Next
Set objNoteSess = CreateObject("Lotus.Notesession")
On Error GoTo 0
If Not objNoteSess Is Nothing Then
  '\\ Instance gets created so we have notes here!
  Set objNoteSess = Nothing
  '\\ Place call to Lotus note routine
  Call LotusSendEmail
Else
  '\\ Place call to outlook routine
  Call OutlookSendEmail
End If
End Sub
 
OK. I am assuming at least one of the client will always be there. Here's the basic idea of handling it. Please adjust sub routine names to suit.
Code:
Public Sub MainRoutine()
Dim objNoteSess As Object
'\\ Try to create a new instance of Lotus notes
On Error Resume Next
Set objNoteSess = CreateObject("Lotus.Notesession")
On Error GoTo 0
If Not objNoteSess Is Nothing Then
  '\\ Instance gets created so we have notes here!
  Set objNoteSess = Nothing
  '\\ Place call to Lotus note routine
  Call LotusSendEmail
Else
  '\\ Place call to outlook routine
  Call OutlookSendEmail
End If
End Sub
Thank for your help. I have one more question about this #7000 error that I get when I send multiple email to myself. The application throws this error.
 

Attachments

  • ERROR7000LOTUSNOTES.png
    ERROR7000LOTUSNOTES.png
    4.3 KB · Views: 0
It is coming from Lotus Notes is all I understand. I have used Lotus Notes in the past and have written couple of routines myself but I don't use it any more so testing is not possible at my end.

Could you post your code please? If possible please mark the line of code which gives you this error. I will try.
 
It is coming from Lotus Notes is all I understand. I have used Lotus Notes in the past and have written couple of routines myself but I don't use it any more so testing is not possible at my end.

Could you post your code please? If possible please mark the line of code which gives you this error. I will try.
Here is the code and the problem happen when I use my email. If I remove my email address, all of the email went to the correct people. It just that my email keep crashing. I am trying to look for doing for CC or BC command that I can use with my name.
 

Attachments

  • Error7000LotusNotesCode.png
    Error7000LotusNotesCode.png
    40 KB · Views: 3
Back
Top