0

I'm trying to call the GUIDFromString Access function from Excel.

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

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

MsgBox accessApp.GUIDFromString("PassingAString")

accessApp.Quit

Set accessApp = Nothing

I've tried different things but all generate an error. The above is generating:

ActiveX component can't create object

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

EDIT: I just came across this post (Password hash function for Excel VBA), using the code from Chris for my purposes.

tutu
  • 673
  • 2
  • 13
  • 31
  • Try `GUIDFromString` instead of `GUIDStromString` ...? – Andre Jul 08 '18 at 09:18
  • @Andre Whoops, corrected it. It generates a different error now "ActiveX component can't create object". – tutu Jul 08 '18 at 09:25
  • From your comments it seems more like you want a hash function. https://stackoverflow.com/questions/125785/password-hash-function-for-excel-vba – Tim Williams Jul 08 '18 at 19:37
  • @TimWilliams Thanks, I already found that post and edited my post including the link – tutu Jul 08 '18 at 20:21

1 Answers1

2

GUIDFromString only works for actual GUID strings, it seems.

In Access:

? GUIDFromString("some string")

ActiveX component can't create object

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

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

It's a byte array, so Debug.Print or MsgBox don't really make sense, but with the GUID string the method works.

Andre
  • 26,751
  • 7
  • 36
  • 80