Reference Error
VJ
Not sure I understand the situation exactly, but I think ThisWorkbook may
need changing to ActiveWorkbook.
ThisWorkbook applies to the add-in, but as I understand it you want to
install the library in the active workbook.
RBS
"VJ" wrote in message
...
I have written a module which copy the code from ModuleA to ModuleB using
reference to "Microsoft Visual Basic for Application Extensibility 5.3".
Code works fine If i use in only one workbook.
But If I use same code in my addIn, which basically copy the code from one
module in the addIn to the client workbook, It throws error and closes
everything.
The Error I get is: "Microsoft has encountered error.......Click close btn
to close.... and after that it closes everything.
I am also setting reference using the following code.
For Each REF In ThisWorkbook.VBProject.References
'Debug.Print ref.Name, ref.GUID, ref.Major, ref.Minor
If REF.name = "VBIDE" Then blnRefFound = True: Exit For
Next
'If reference is not checked, then check it by setting the values
in the registry
If blnRefFound = False Then
ThisWorkbook.VBProject.References.AddFromGuid _
GUID:="{0002E157-0000-0000-C000-000000000046}", _
Major:=5, Minor:=3
End If
Can somebody pls help me out?
|