Determine default email client (1 Viewer)

davidbenson34

New member
Local time
Today, 03:54
Joined
Apr 2, 2008
Messages
4
I have a button which sends the activesheet as an email attachment via a macro. It does not work if the default email client is Windows Live, though, - I think because the attach function in Hotmail is carried out using a web-based interface.

I would like to check first, with vba, whether Outlook or Outlook Express is the default email client. If neither are set as the current default client, I would set the visibility of that button to false, since emailing a sheet as an attachment was more of an extra optional functionality. Thanks in advance for any help.
David
 

ajetrumpet

Banned
Local time
Today, 02:54
Joined
Jun 22, 2007
Messages
5,638
Just a thought here:

Are you doing this on just one machine? If you are, why do this? Just check the CP for the default. If you aren't, maybe there is another way to do this?

I have no idea how to do this in VBA, but I do know how to explore other options. :)
 

davidbenson34

New member
Local time
Today, 03:54
Joined
Apr 2, 2008
Messages
4
Thanks for your reply!
It is an excel-based application that would be downloaded and opened on different machines. Of course, they would have different default clients installed and no way to know which ones. I'm hoping to find a way to at least check if it's not Outlook or Outlook Express. If that is the case, they simply wouldn't see the button.
David
 

davidbenson34

New member
Local time
Today, 03:54
Joined
Apr 2, 2008
Messages
4
I found a solution. After locating the default email client key in the registry, I found a code snippet that reads the value of a key and applied it:

Code:
'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
 

DAW

Registered User.
Local time
Today, 00:54
Joined
Mar 22, 2006
Messages
70
Brilliant! over a year after the above post and this just helped me out of a tricky issue :)
 

Users who are viewing this thread

Top Bottom