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

vba code to find default email program

What is the line of code to detect which email program a user use?I'm
The email is opened thru a web portal.There is a spreadsheet attached .There is a send button in the spreadsheet with a specific address to mail to. In my test,when I clicked it,I noticed that there is no send button in the email program that opened.That PC I used had Outlook installed.It seemed that it could not find the email program.
0
zachvaldez
Asked:
zachvaldez
  • 3
  • 2
1 Solution
 
Neil RussellTechnical Development LeadCommented:
'reads the value for the default email client
'if the key cannot be found, the return value is ""
Dim myWS As Object
Dim RegKey As String
Dim Key As String

Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail\"
 
  On Error Resume Next
  'access Windows scripting
  Set myWS = CreateObject("WScript.Shell")
  'read key from registry
  RegKey = myWS.RegRead(Key)
 
  If RegKey = "Microsoft Outlook" Or RegKey = "Outlook Express" Then
 
    Call show_email_buttons
 
  Else
 
    Call hide_email_buttons
 
  End If

From

http://www.access-programmers.co.uk/forums/showthread.php?t=146950
0
 
zachvaldezAuthor Commented:
What if email program is other than Microsoft like lotus notes,GroupWise,etc.?
0
 
Neil RussellTechnical Development LeadCommented:
Then change   If RegKey = "Microsoft Outlook" Or RegKey = "Outlook Express" Thento what you want to find.
0
Industry Leaders: 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!

 
dev00790Commented:
As a side question - when the registry is locked down, so that a User does not have access to it, is there an alternate method for finding the email program?
0
 
Neil RussellTechnical Development LeadCommented:
The info is stored in the registry so no
0
 
zachvaldezAuthor Commented:
Just to apply to all possible email programs.....,the developer may not cover all it?
0

Featured Post

Technology Partners: 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!

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