We are developed a VBA Program in 2008 enviroment, now we are try to use the same VBA Program in 2012. While using, a VBA command( IAcadModelSpace2) not functioning.
Dim oMSpace As IAcadModelSpace2
Set oMSpace = ThisDrawing.ModelSpace
Pls help as quick as possible.
Thanks
Raju
You simply change the Declaration of the variable "oMSpace" to:
Dim oMSpace As AcadModelSpace
then the code should work again. Some explanation here:
IAcadModelSpace2 is just a new Interface added to certain version of AutoCAD to allow new property/method to be added to an existing class without breaking the class' backward compatibility. This is usually done with AutoCAD's minor version between major version changes (every 3 years, until Acad2015). The new property/method introduced with this kind of Interfaces in AutoCAD's minor version would be merged into the relevant classes in AutoCAD major version change and these interfaces would disaappear.
In this case, Acad2008 added something new to AcadModelSpace class. Since Acad2008 was not a major version (2007 was), so the new stuff to AcadModelSpace was added to IAcadModelSpace2 (you can imagine, there was IAcadModelSpace1 prior to Acad2007), so that all code previously worked with AcadModelSpace still see the same AcadModelSpace as Acad2007, and you only need to use IAcadModelSpace2 for new features that is not available in Acad2007. That is, IAcadModelSpace includes all AcadModelSpace from Acad2007 plus something new. IAcadModelSpace2 would be available also in Acad2009, until Acad2010, where the new feature added into AcadModelSpace (as IAcadModelSpace2) would be merged into AcadModelSpace. Thus, since Acad2010, IAcadModelSpace2 is no long needed and is no longer exposed in AutoCAD object model.
HTH.