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?
Rob4077Asked:
Who is Participating?
 
QlemoConnect With a Mentor 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
 
QlemoBatchelor, 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 
QlemoBatchelor, 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.