• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 467
  • Last Modified:

How to determine type of email client is installed using VBA


I am working on an Access 2007 application where I have installed a generic error handler.  There is a email function that I am trying to implement that will email a report.  I know how to use either outlook or lotus notes to send email via automation from access.  However, I want to be determine what type of email client is installed.  For example, if a user has Lotus Notes installed, the report would be sent via lotus note, if a user has outlook installed, the report would be sent via outlook.  How do I determine the mail client that is installed on a machine via vba.  I'm thinking it might require a windiows api call
  • 2
2 Solutions
vba and vbscript:

<pre>Sub GetMailClient()
Dim RegVal As String, MailProg As String
Dim CharPos As Integer, RegValLength As Integer
Dim WshShell
Set WshShell = CreateObject("Wscript.shell")
RegVal = WshShell.regread("HKEY_CLASSES_ROOTmailtoshellopen command")
Set WshShell = Nothing
RegValLength = Len(RegVal)
For CharPos = RegValLength To 0 Step -1
On Error Resume Next 'In case there's no path
If Mid(RegVal, CharPos, 1) = "" Then
MailProg = Mid(RegVal, CharPos + 1)
Exit For
End If
Next CharPos
RegValLength = Len(MailProg)
For CharPos = 1 To RegValLength Step 1
If Mid(MailProg, CharPos, 1) = "." Then
MailProg = Mid(MailProg, 1, CharPos + 3)
Exit For
End If
Next CharPos
MailProg = """" & MailProg & """" 'enclose in quotes just in case of long filename
MsgBox "Your default e-mail client is: " & MailProg
End Sub

Open in new window

Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
There is a reg key for this. I could not get GlobaLevel's code to work.

 reg key
chtullu135Author Commented:
Thanks for the info.  I'm sorry for the delay in responding,  I'm in the process of addressing some other issues concerning another database.  I'll get back to this problem in a day.  

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now