例子: pclass.dll (activex dll ,類名稱:class1) public function myfunction(byval i as integer) as integer myfunction= i end function
主程序調用: private sub command1_click() on error goto errorhandle: dim obj as object set obj = createobject("pclass.class1") 'pclass是dll名稱,class1是pclass.dll中的類名稱 '注意:不是模塊名稱 msgbox obj.myfunction(20) set obj = nothing exit sub errorhandle: msgbox err.description & " -- 清檢查dll文件名稱、類名稱、是否注冊等!" err.clear end sub