Hi Scott and modelright:
I have got the sample code to run, but the process required strongly suggests problems in the preparation of SCF.dll for deployment. First the test conditions:
SCF.dll 3044. WinXP, SP2, Visual Studio 2005 NOT installed. Using VBA in Excel 2003.
The sample VBA procedure:
---------------------------------------
Sub Test()
Dim Framework As ScriptFramework
Dim Models As MRModelCollection
Dim Model As MRModel
Dim Tables As MRObjectCollection
Dim Table As MRObject
Dim PropValue As MRPropertyValue
Dim MRO As MRObject
Dim V As Variant
Set Framework = CreateObject("SCF.ScriptFramework")
Framework.Initialize ' <-- Apparently needed
'--------- 3. Try LoadModel ----------
Set Model = Framework.LoadModel(LoadPath) ' OK
Debug.Print Model.Name, Model.ID ' Succeeds
Model.BeginTransaction ("Batch Rename Tables")
Set MRO = Model.AsObject
Set V = MRO.Children("Table") ' Error WAS here
Set Tables = V
For Each Table In Tables
Debug.Print Table.Name, Table.ID
Set PropValue = Framework.CreatePropertyValue("Table", "Name")
PropValue.FromString ("T_" + Table.Name)
Table.SetProperty "Name", PropValue
Next
Model.EndTransaction
Framework.SaveModel SavePath, Model
End Sub
-----------------------------------------------
1. I noted that the version of Dependency Walker that was getting launched was from VS6, and didn't know about newer dependencies, so I obtained latest DW 2.2. This reinforced missing VS2005 dependencies.
2. I obtained from MS the VS 2005 redistributables (regular and SP1), and installed them. This resulted in fewer missing dependencies in DW.
3. DW still says "errors detected", and thinks that SCF.dll is looking for MFC80.DLL, MSVCP80.DLL, MSVCR80.DLL in the MR home directory (or maybe doesn't find compatible versions in winsxs). However, there are other refs to these DLLs that DW successfully resolves to the shared assemblies in winsxs. Not sure what to make of that, but I carried on regardless.
4. At this stage, running the above test proc continued to crash VBA and Excel when executing the MRO.Children line. So I stepped to that point while watching file activity in FileMon. After earlier statements correctly accessing SCF.dll in MR's home dir, at that statement Excel/VBA looks for SCF.dll in Excel's executable directory! (..OFFICE11/bunch-of-exes). ... which fails, leading to Dr Watson etc.
5. So I copied SCF.dll to Excel's exe directory. Result was similar but did proceed further, looking for MR's ot900as.dll in Excel directory.
6. I copied ot900as.dll to the Excel dir.
Presto, now the VBA sample code runs, iterates through the tables, modifies the names and saves the model, as judged by subsequently loading it into MR. (FWIW, this is a model of mysql's sakila demo DB).
The one bad thing is that trying to run it a *second time* within Excel causes a crash at the LoadModel statement, indicating that cleanup didn't happen automatically at end of previous execution, (eg: VB garbage collection on Framework fails to prompt GC cleanup) and/or Initialize is quite initial enough :-).
Anyhow... it runs. I don't think I trust it enough to do serious work on it at this stage, but hopefully all these clues are helpful in your tracking down the problems.
Graham