Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Detect All Versions of XML On Client Machine

Posted on 2005-02-25
2
Medium Priority
?
142 Views
Last Modified: 2010-05-02
I need to detect ALL working versions of MSXML on a client machine using PURE Visual Basic.  Here is what I have so far:

Private Sub Form_Load()
   Dim szMsg As String
   If CheckParser("Msxml.DOMDocument") Then
     szMsg = "MSXML Installed"
   End If
   MsgBox szMsg

Function CheckParser(ByVal szProgId) As Boolean
   On Error GoTo Err_Handler
   
   Dim oXML As Variant
   CheckParser = True
   Set oXML = CreateObject(szProgId)
   Err_Exit:
   Exit Function
   Err_Handler:
   CheckParser = False
   Resume Err_Exit
End Function
0
Comment
Question by:Hepen
1 Comment
 
LVL 14

Accepted Solution

by:
aelatik earned 2000 total points
ID: 13409719
You are on the right track, you only need to loop through versions.

Private Sub Form_Load()
    Debug.Print CheckParserInVersions("MSXML", "DOMDOCUMENT", 5)
End Sub

Function CheckParserInVersions(ObjName As String, ObjType As String, VersionCount As Integer) As String
    Dim i As Integer
    Dim Buffer As String
    Dim Version As String
    For i = 1 To 5
        If i > 1 Then Version = i Else Version = ""
        On Error Resume Next
        If IsObject(CreateObject(ObjName & Version & "." & ObjType)) Then
            If Err.Number > 0 Then
                Buffer = Buffer & ObjName & Version & "." & ObjType & " does not exist !" & vbCrLf
                On Error GoTo 0
            Else
                Buffer = Buffer & ObjName & Version & "." & ObjType & " exists !" & vbCrLf
            End If
           
        End If
    Next
    CheckParserInVersions = Buffer
End Function
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question