从 Excel 调用访问函数

Calling Access function from Excel

我正在尝试从 Excel 调用 GUIDFromString 访问函数。

Dim accessApp
Set accessApp = CreateObject("Access.Application")

accessApp.OpenCurrentDatabase (ThisWorkbook.Path & "\" & "DB.accdb")

MsgBox accessApp.GUIDFromString("PassingAString")

accessApp.Quit

Set accessApp = Nothing

我尝试了不同的方法,但都产生了错误。 以上正在生成:

ActiveX component can't create object

(https://msdn.microsoft.com/en-us/vba/access-vba/articles/application-guidfromstring-method-access)

编辑:我刚刚遇到这个 post (Password hash function for Excel VBA),出于我的目的使用 Chris 的代码。

GUIDFromString 似乎只适用于实际的 GUID 字符串。

访问中:

? GUIDFromString("some string")

ActiveX component can't create object

? References(1).Guid
{000204EF-0000-0000-C000-000000000046}

? GUIDFromString("{000204EF-0000-0000-C000-000000000046}")
?  À  ?

它是一个字节数组,因此 Debug.Print 或 MsgBox 没有真正意义,但使用 GUID 字符串该方法有效。