dkjean
asked on
Check if word is installed vb.net
HI,
This script failed on computers with and with out word installed.
Set objNetwork = CreateObject("Wscript.Netw ork")
Set objSysInfo = CreateObject("ADSystemInfo ")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
Set objUnder = GetObject(objUser.Parent)
Set objHoved = GetObject(objUnder.Parent)
strUser = objUser.Get("sAMAccountNam e")
If Not Type (objword) = "Nothing" Then
Set objWord = CreateObject("Word.Applica tion")
objWord.UserName = objUser.givenName & " " & objUser.SN
objWord.UserInitials = objUser.sAMAccountName
objLogFile.WriteLine "Jobbet er fuldført: " & "Office initialer er rettet."
objWord.Quit
Else
objLogFile.WriteLine "Der blev ikke fundet Word:" & "Ingen rettelser."
End If
This script failed on computers with and with out word installed.
Set objNetwork = CreateObject("Wscript.Netw
Set objSysInfo = CreateObject("ADSystemInfo
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
Set objUnder = GetObject(objUser.Parent)
Set objHoved = GetObject(objUnder.Parent)
strUser = objUser.Get("sAMAccountNam
If Not Type (objword) = "Nothing" Then
Set objWord = CreateObject("Word.Applica
objWord.UserName = objUser.givenName & " " & objUser.SN
objWord.UserInitials = objUser.sAMAccountName
objLogFile.WriteLine "Jobbet er fuldført: " & "Office initialer er rettet."
objWord.Quit
Else
objLogFile.WriteLine "Der blev ikke fundet Word:" & "Ingen rettelser."
End If
ASKER
I get a error in line "set objword = CreateObject("word.Applica tion")
On a machine were there is no word installed.
Yes about the log :-)
On a machine were there is no word installed.
Yes about the log :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot
I did'net work on the machines without word.
But I have use your script with the string.... On error Resume Next
It works.
I did'net work on the machines without word.
But I have use your script with the string.... On error Resume Next
It works.
You can simulate as Word (or any other application not installed) not installed by using following code:
Set objWord = CreateObject("NoWord.Application")
You will error at the line where "objLogFile" is there becuase it is not created.
Open in new window