インタフェース機能で 実現しました。(2019年 初研究です)
---フォームから クラスモジュールを呼び出す処理--------------
Private Sub UserForm_Initialize()
~ 略 ~
On Error GoTo MyErr
strLEBEL = "はじめにクラスモジュールをセットする"
~ 略 ~
args = "M_Person" // パラメータをセット
Set sRS = Constructor(New sqlRecordSet, args)
↑ ' パラメータ "args" 付きで クラス を開く
-------------------------------------------------------------
解説: ①インタフェースをつくります。
---インタフェース----------------------------------------------
Option Explicit
Public Function Instancing(ByVal args As String) As IConstructor: End Function
--------------------------------------------------------------
解説: ②起動用のメソッドををつくります。
---標準モジュールの起動メソッド---------------------------------
Public Function Constructor(ClassObject As IConstructor, ByVal args As String) As IConstructor
Set Constructor = ClassObject.Instancing(args)
End Function
---------------------------------------------------------------
解説: ③クラスモジュールにインタフェースを実装します。
---クラスモジュール ---------------------------------------------
'コンストラクタ---Class_Initialize()に引き続いて実行される
Public Function IConstructor_Instancing(ByVal args As String) As IConstructor
Set IConstructor_Instancing = Me // インタフェースを呼び出します。
SetMe (args) // 実際の 起動時処理を CALLします。
End Function
--------------------------------------------------
※ 参考になったサイト
<https://foolexp.wordpress.com/…/%E3%82%B3%E3%83%B3%E3%82%B…/>