Determine if Word is Installed

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi;

Using Acc2K & VBA6.0

Have been searching, for quite some time, for the code:
"How to Programmatically Determine installed applications?"

Found it easily "A long time ago." at MSDN when it wasn't needed, and now
that it is needed can't find it.

If the user has any version of MSWord on their computer want the code to
open a form that offers a choice for viewing and printing an Access rpt.

If Word is installed open frmWantToUseWord
Else
Open standard Access Rpt.

Would someone be so kind to reply either with the proper way I should
construct the question for an MSDN search or with the code itself?

Thank You.

Andy
 
Perhaps this is an over simplification but if you attempted to create an
instance of Word, and it failed, then I think we can safely assume that Word
is either not installed or is seriously broken. The function below does
exactly that. There might be another way to do this that is faster, uses
less resources and / or code, but this ought to work everywhere.

Public Function HasWord() As Boolean
Dim objWord As Object

HasWord = True ' Assume we'll Succeed
On Error GoTo errNoWord
Set objWord = CreateObject("Word.Application")
objWord.Quit
errNoWordOut:
Set objWord = Nothing
Exit Function
errNoWord:
HasWord = False ' Rut Row R'Astro
Resume errNoWordOut
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top