【转载】VBA–早期和后期绑定声明
时 间:2023-03-14 09:58:32
作 者:金宇 ID:43 城市:江阴
摘 要:VBA早期和后期绑定声明
正 文:
这些应该是了解哪些早期绑定声明需要哪些参考库的很好的起点,同时也有助于任何想要向任一方向转换的人。
我希望这对你们中的一些人有所帮助!
以下是迄今为止提供的示例:
Microsoft Access XX.X Object Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Access XX.X Object Library (msacc.olb) |
||
EXAMPLE |
Dim oAccess As Access.Application
Set oAccess = New Access.Application |
Dim oAccess As Object
Set oAccess = CreateObject(“Access.Application”) |
Microsoft ActiveX Data Object X.X Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft ActiveX Data Object X.X Library (msadoXX.dll) |
||
EXAMPLE CONNECTION |
Dim oADODBConnection As ADODB.Connection
Set oADODBConnection = New ADODB.Connection |
Dim oADODBConnection As Object
Set oADODBConnection = CreateObject(“ADODB.Connection”) |
|
EXAMPLE STREAM |
Dim oADODBStream As ADODB.Stream
Set oADODBStream = New ADODB.Stream |
Dim oADODBStream As Object
Set oADODBStream = CreateObject(“ADODB.Stream”) |
Microsoft ADO Ext. X.X for DDL and Security Object Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft ADO Ext. X.X for DDL and Security Object Library (msadox.dll) |
||
EXAMPLE CATALOG |
Dim oCat As ADOX.Catalog
Set oCat = New ADOX.Catalog |
Dim oCat As Object
Set oCat = CreateObject(“ADOX.Catalog”) |
Microsoft DAO 3.6 Object Library
This is a special case as there can be 2 distinct Libraries used here depending on the targetted database!
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft DAO X.X Object Library (older mdb) (daoXXX.dll) or Microsoft Office XX.X Access database engine Object Library (newer accdb & mdb) (acedao.dll ???) |
||
EXAMPLE |
Dim oDAO As DAO.DBEngine
Set oDAO = New DAO.DBEngine |
Dim oDAO As Object
On Error Resume Next
On Error Goto 0 |
Microsoft Excel XX.X Object Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Excel XX.X Object Library (excel.exe) |
||
EXAMPLE |
Dim oExcel As Excel.Application
Set oExcel = New Excel.Application |
Dim oExcel As Object
Set oExcel = CreateObject(“Excel.Application”) |
Microsoft Internet Controls
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Internet Controls (ieframe.dll) |
||
EXAMPLE INTERNET EXPLORER |
Dim oIE As SHDocVw.InternetExplorer
Set oIE = New SHDocVw.InternetExplorer |
Dim oIE As Object
Set oIE = CreateObject(“InternetExplorer.Application”) |
Microsoft HTML Object Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft HTML Object Library (mshtml.tlb) |
||
EXAMPLE |
Dim oHTMLDoc As MSHTML.HTMLDocument
Set oHTMLDoc = New MSHTML.HTMLDocument |
Dim oHTMLDoc As Object
Set oHTMLDoc = CreateObject(“HTMLFile”) |
Microsoft PowerPoint XX.X Object Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft PowerPoint XX.X Object Library (msppt.olb) |
||
EXAMPLE |
Dim oPowerPoint As PowerPoint.Application
Set oPowerPoint = New PowerPoint.Application |
Dim oPowerPoint As Object
Set oPowerPoint = CreateObject(“PowerPoint.Application”) |
Microsoft Scripting Runtime
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Scripting Runtime (scrrun.dll) |
||
EXAMPLE DICTIONARY |
Dim oDictionary As Scripting.Dictionary
Set oDictionary = New Scripting.Dictionary |
Dim oDictionary As Object
Set oDictionary = CreateObject(“Scripting.Dictionary”) |
|
EXAMPLE FSO |
Dim oFSO As Scripting.FileSystemObject
Set oFSO = New Scripting.FileSystemObject |
Dim oFSO As Object
Set oFSO = CreateObject(“Scripting.FileSystemObject”) |
Microsoft Speech Object Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Speech Object Library (sapi.dll) |
||
EXAMPLE |
Dim oSpVoice As SpeechLib.SpVoice
Set oSpVoice = New SpeechLib.SpVoice |
Dim oSpVoice As Object
Set oSpVoice = CreateObject(“SAPI.SpVoice”) |
Microsoft Windows Image Acquisition Library vX.X
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Windows Image Acquisition Library vX.X (wiaaut.dll) |
||
EXAMPLE IMAGEFILE |
Dim oImageFile As WIA.ImageFile
Set oImageFile = New WIA.ImageFile |
Dim oImageFile As Object
Set oImageFile = CreateObject(“WIA.ImageFile”) |
|
EXAMPLE IMAGEPROCESS |
Dim oImageProcess As WIA.ImageProcess.
Set oImageProcess = New WIA.ImageProcess |
Dim oImageProcess As Object
Set oImageProcess = CreateObject(“WIA.ImageProcess “) |
Microsoft Windows Installer Object Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Windows Installer Object Library (msi.dll) |
||
EXAMPLE |
Dim oMSI As WindowsInstaller.installer
Set oMSI = CreateObject(“WindowsInstaller.Installer”) |
Dim oMSI As Object
Set oMSI = CreateObject(“WindowsInstaller.Installer”) |
Microsoft Word XX.X Object Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Word XX.X Object Library (msword.olb) |
||
EXAMPLE |
Dim oWord As Word.Application
Set oWord = New Word.Application |
Dim oWord As Object
Set oWord = CreateObject(“Word.Application”) |
Microsoft XML
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft XML, vX.X (msxml6.dll) |
||
EXAMPLE |
Dim oHttp As MSXML2.XMLHTTP60
Set oHttp = New MSXML2.XMLHTTP60 |
Dim oHttp As Object
Set oHttp = CreateObject(“MSXML2.XMLHTTP.6.0”) |
Microsoft VBScript Regular Expressions
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft VBScript Regular Expressions X.X (vbscript.dll) |
||
EXAMPLE |
Dim oregEx As VBScript_RegExp_55.RegExp
Set oregEx = New VBScript_RegExp_55.RegExp |
Dim oregEx As Object
Set oregEx = CreateObject(“VBScript.RegExp”) |
Microsoft WMI Scripting VX.X Library
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft WMI Scripting VX.X Library (wbemdisp.tlb) |
||
EXAMPLE |
Dim oWMI As WbemScripting.SWbemServices
Set oWMI = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2”) |
Dim oWMI As Object
Set oWMI = GetObject(“winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2”) |
Note: There are different namespace that can be used ‘\root\cimv2’.
Microsoft Script Control 1.0
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Script Control 1.0 (msscript.ocx) |
||
EXAMPLE |
Dim oScriptControl As MSScriptControl.ScriptControl
Set oScriptControl = New MSScriptControl.ScriptControl |
Dim oScriptControl As Object
Set oScriptControl = CreateObject(“MSScriptControl.ScriptControl”) |
Note: Does not work in 64-bit! Refer to: https://github.com/tablacus/TablacusScriptControl
Windows Script Host Object Model
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Windows Script Host Object Model (wshom.ocx) |
||
EXAMPLE WSCRIPT.SHELL |
Dim oWshShell As IWshRuntimeLibrary.WshShell
Set oWshShell = New IWshRuntimeLibrary.WshShell |
Dim oWshShell As Object
Set oWshShell = CreateObject(“WScript.Shell”) |
|
EXAMPLE WSCRIPT.NETWORK |
Dim oWshNetwork As IWshRuntimeLibrary.WshNetwork
Set oWshNetwork = New IWshRuntimeLibrary.WshNetwork |
Dim oWshNetwork As Object
Set oWshNetwork = CreateObject(“WScript.Network”) |
Microsoft Shell Controls And Automation
EARLY BINDING | LATE BINDING | ||
---|---|---|---|
REFERENCE |
Microsoft Shell Controls And Automation (shell32.dll) |
||
EXAMPLE |
Dim oShell As Shell32.Shell
Set oShell = New Shell32.Shell |
Dim oShell As Object
Set oShell = CreateObject(“Shell.Application”) |
Access软件网官方交流QQ群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access对子窗体数据进行批...(10.30)
- 最精简的组合框行来源数据快速输...(10.25)
- Access仿平台的多值选择器...(10.24)
- 【Access日期区间段查询】...(10.22)
- 【Access源码示例】VBA...(10.12)
- Access累乘示例,Acce...(10.09)
- 数值8.88,把整数8去掉,转...(10.08)
- 【Access自定义函数】一个...(09.30)
- 【Access选项卡示例】Ac...(09.09)
学习心得
最新文章
- Access快速开发平台企业版--...(11.18)
- 不会用多表联合查询,多表查询没结果...(11.16)
- 【案例分享】主键字段值含有不间断空...(11.16)
- Access快速开发平台--后台D...(11.14)
- 微软Access邀测新Monaco...(11.12)
- Access列表框左右互选、列表框...(11.11)
- 高效率在导入数据前删除记录(11.10)
- Access报价单转订单示例代码(11.08)
- Access系统自带的日期选择器不...(11.08)
- 分享一下Access工程中的acw...(11.07)