How to generate the MD5 hash of a file using VBA

I am working on a file management application using microsoft access.  Users will be selecting a file to "file" into the relevant directory according to given parameters.  I want to generate the MD5 hash of files that have already been "filed".  When the user goes to file a new file, the md5 hash value of the new file will be calculated - and checked against the existing "filed" files to check for duplicates.  Does anyone know of a source of VBA code that I can use to generate these values.
I havent posted many questions to this forum - have nearly always been able to find exactly what I want by searching other questions.  I have allocated maximum points because I havent been able to find a solution elsewhere.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cteakleAuthor Commented:
Hi Peter57r
I had a look at that post and tried to import the code into my vba without success. However, one difference is that I want to start with a file - not some string and generate the value for the file
I know nothing about this topic - I'm just aware of the Qs being posted about it.

Here is another Q which deals with a file using the same code.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

cteakleAuthor Commented:
Thanks Peter
I will have a try using this code tonight (australian time)
cteakleAuthor Commented:
Hi again Peter - or whomever may be reading these posts.  I remember why I couldnt get this to work before when I tried it on just a string.  I have put Xs around the line of code that causes a problem.  I get a "cannot divide by zero" message, no matter what string I enter.  The problem for me is I have no idea at all what the code is doing, so dont know where to look to try and solve the problem.   The other bit seemed to work though on converting a file to a string in order to use the code.

    ' We do not care about the top most bit or the final bit, the top most bit
    ' will be taken into account in the next stage, the final bit (whether it
    ' is an odd number or not) is being shifted into, so we do not give a jot
    ' about it
XXXX    RShift = (lValue And &H7FFFFFFE) \ m_l2Power(iShiftBits)XXXX
    ' If the top most bit (&H80000000) was set we need to do things differently
    ' as in a normal VB signed long integer the top most bit is used to indicate
    ' the sign of the number, when it is set it is a negative number, so just
    ' deviding by a factor of 2 as above would not work.
    ' NOTE: (lValue And  &H80000000) is equivalent to (lValue < 0), you could
    ' get a very marginal speed improvement by changing the test to (lValue < 0)
cteakleAuthor Commented:
Sorry - my ignorance.  I had to do a bit more research on classes.  I hadnt inserted the module as a class module.  All seems to be working properly now.  Thanks very much for your help Peter
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.