How to test the presence of Outlook on the PC

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
giovanniroi
Junior Coder
Posts: 21
Joined: Fri Jul 03, 2009 4:36 pm
Location: Milan,Italy

How to test the presence of Outlook on the PC

Post by giovanniroi » Mon Jun 18, 2012 5:55 pm

I created a routine to send mail with Outlook that shows me a runtime error if Outlook is not installed on your computer.

How can I check if Outlook is installed on the PC to prevent the error of Run Time 429?

Thank's for the support

Giovanni Roi

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jun 19, 2012 9:32 am

So why not check for that error?

On Error Resume Next
Set ol = CreateObject("bla")
If Error.Number = 429 Then
MsgBox "bla is not installed"
End if
On Error Goto 0
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

giovanniroi
Junior Coder
Posts: 21
Joined: Fri Jul 03, 2009 4:36 pm
Location: Milan,Italy

Post by giovanniroi » Wed Jun 27, 2012 2:49 pm

I Try to make this script but I have always an error message also if I have installed Outlook

===================
VBStart
Function TestOutlook()
On Error Resume Next
'Create OL App object
Set objOLApp = CreateObject("Outlook.Application")
If Error.Number = 429 Then
TestOutlook = "Outlook non presente"
Exit Function
End If

'Free up the space
Set objOLApp = Nothing
TestOutlook = "Success"
End Function
VBEnd
VBEval>TestOutlook(),Answer
MessageModal>Answer
==================

Is this script correct?

Thank's for the support

Giovanni Roi

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Jun 27, 2012 4:31 pm

My mistake, it should be:

If Err.Number = 429 Then
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

giovanniroi
Junior Coder
Posts: 21
Joined: Fri Jul 03, 2009 4:36 pm
Location: Milan,Italy

Post by giovanniroi » Wed Jun 27, 2012 6:06 pm

Thank's, now is working and this solve my problem.

Giovanni Roi

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts