MichaelRed
Programmer
After reviewing numerous threads
numerous small clues in several
allowing the turtle like speed of my 'brain'
...
The last and apparently most necessary: you MUST save AND compile all modules /[color] before creating one! Compile does NOT (as was pointed out) save the module (it appears to simply approve of the code as it exists).
from the Debug window:
strDwg = "Dwg_Test_4_Exe"
basModules_Main(strDwg)
then the following code created two modules
Thanks to the several contributors who gave their insight(s)!!!
MichaelRed
numerous small clues in several
allowing the turtle like speed of my 'brain'
...
The last and apparently most necessary: you MUST save AND compile all modules /[color] before creating one! Compile does NOT (as was pointed out) save the module (it appears to simply approve of the code as it exists).
from the Debug window:
strDwg = "Dwg_Test_4_Exe"
basModules_Main(strDwg)
then the following code created two modules
Code:
Public Function basModules_Main(strDwg As String)
Dim blnDone As Boolean
Dim Idx As Integer
Dim strNewName(1) As String
Dim strOldName As String
Dim strTemp As String
strNewName(0) = strDwg & "_Exe"
strNewName(1) = strDwg & "_Test"
Do While Idx <= UBound(strNewName)
RunCommand acCmdCompileAndSaveAllModules
strTemp = strNewName(Idx)
strOldName = basModule_Make("XXX")
blnDone = basCls_Sav_Ren(strOldName, strTemp)
Idx = Idx + 1
Loop
End Function
Public Function basCls_Sav_Ren(strOldName As String, strNewName As String)
DoCmd.Close acModule, strOldName, acSaveYes
DoCmd.Save acModule, strOldName
DoCmd.Rename strNewName, acModule, strOldName
End Function
Public Function basModule_Make(strMod As String) As String
Dim mdl As Module
DoCmd.RunCommand acCmdNewObjectModule
' Set MyModule to be the new Module Object.
Set mdl = Application.Modules.Item(Application.Modules.Count - 1)
basModule_Make = mdl
End Function
Thanks to the several contributors who gave their insight(s)!!!
MichaelRed