File not found - yet it is there

A while ago I incorporated the following code into a spreadsheet and it worked well.
Private Declare Function GenIosMapUrl Lib _
        "D:\Rob\Offline Docs\Innoprac\FullPoleList\MapsMeGeoMaker.dll" _
        (ByVal latit As Double, ByVal longit As Double, ByVal zoom As Double, ByVal locName As String) As String

Public Function iosURL(Latitude As Double, Longitude As Double, zoom As Double, Name As String) As String
    Dim URL As String
    URL = GenIosMapUrl(Latitude, Longitude, zoom, Left(Name, 30)) 'limit length of name to 20 characters for now
    'iosURL = Left(URL, Len(URL) - 1) 'remove trailing chr(0)
    iosURL = URL
End Function

Open in new window

Then my SSD died so I had to replace it and reinstall Windows 10 Home. This time I put the dll in the root directory, "C:\MapsMeGeoMaker.dll" (and several others to try to resolve) but every time I run it I get the message Run-time error '52': File not found "C:\MapsMeGeoMaker.dll". I've checked the spelling and even run a function to test that the file exists (in case I did something really super-stupid) and the dll is definitely there but the function won't work.

Does anyone know what I might be doing wrong?
LVL 1
Rob4077Asked:
Who is Participating?

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

x
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.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
The root folder might be protected by Defender, as it is a common location to place malicious code.
There are also specific privileges assigned to it.
Please move the DLL elsewhere - this is a very bad location ...
0
Rob4077Author Commented:
Originally I saved it in the same folder as my spreadsheet but the same problem arises there. Anyway I tried saving it to a new folder to see what it would do but same result
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Might be that there are missing dependencies (other DLLs) for that DLL. You can check if you are missing something important for example by opening the DLL with depends (http://www.dependencywalker.com/).
0

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
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Rob4077Author Commented:
Thanks. That could be the problem. I need to download some files and install some programs to test it. Will report back here ASAP
0
Rob4077Author Commented:
Yep, that did it. I reinstalled Visual Studio, the program I used to create the dll in the first place, and it now works. There must be a file there that it uses. Thank you for the solution!
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Visual Studio installs the debug and runtime libs (msvc*, mfc* and many more) fitting to its own version into the System32 (or SysWoW64) folder, where they are searched for without further setup.
0
Rob4077Author Commented:
I didn't realise. Thanks
0
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
Windows 10

From novice to tech pro — start learning today.