?
Solved

Detect All Versions of XML On Client Machine

Posted on 2005-02-25
2
Medium Priority
?
132 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

801 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