Hello karthikcoep,
The problem is the reference library isn't loaded on the other machines. The workbook I posted has the reference saved. I have added a macro that will automatically load the library reference when the workbook is opened. Here is the auto loading macro which is called by the Workbook_Open() event procedure. This macro is located in Module1.
Sub AddListViewControl()
Dim P As Variant
Dim Paths As Variant
Dim RefFile As String
Dim X As String
RefFile = "MSCOMCTL.OCX"
Paths = Split(Environ("Path"), ";")
For Each P In Paths
X = Dir(P & "\" & RefFile)
If X = RefFile Then Exit For
Next P
If X = "" Then
MsgBox "The directory for " & RefFile & " could not be found."
Exit Sub
Else
RefFile = P & "\" & RefFile
End If
On Error Resume Next
Application.VBE.ActiveVBProject.References.AddFromFIle RefFile
If Err = 0 Or Err = 32813 Then Err.Clear
On Error GoTo 0
End Sub
Workbook Open Event - ThisWorkbook Module
Private Sub Workbook_Open()
Call AddListViewControl
End Sub
Sincerely,
Leith Ross
Bookmarks