Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default problem with "file not found" calling a dll from VBA

I'm going nuts!
From VBA I call a routine in a DLL which was compiled with visual
studio (language is fortran)
It works fine on some computers, but on others it throws up a

Run-time error '53':
File not found: myfilename.dll

It does this even though the dll file is quite definitely there.
A small program compiled with VB6 to do what VBA does behaves the same
way.

In the VB code if I change the name of the routine being called to a
name that is not in the dll, the same error message is displayed.

Something is messed up somewhere, but I just can't figure out what it
is!@#$%

Has anyone encountered this problem, and know how to solve it? I'm
desperate.

The problem can happen with either XP or Vista, and with either excel
2003 or excel 2007.

Thanks,

Brian
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default problem with "file not found" calling a dll from VBA

How are you declaring the function and where is the dll. If the full path is
not included in the declaration is the dll in one of the places that
automatically get searched, eg the system32 folder. Or are you doing a ChDir
to the path before calling.

Regards,
Peter T

"Brian Murphy" wrote in message
...
I'm going nuts!
From VBA I call a routine in a DLL which was compiled with visual
studio (language is fortran)
It works fine on some computers, but on others it throws up a

Run-time error '53':
File not found: myfilename.dll

It does this even though the dll file is quite definitely there.
A small program compiled with VB6 to do what VBA does behaves the same
way.

In the VB code if I change the name of the routine being called to a
name that is not in the dll, the same error message is displayed.

Something is messed up somewhere, but I just can't figure out what it
is!@#$%

Has anyone encountered this problem, and know how to solve it? I'm
desperate.

The problem can happen with either XP or Vista, and with either excel
2003 or excel 2007.

Thanks,

Brian



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default problem with "file not found" calling a dll from VBA

I've tried all the things you've suggested. That's why I'm going
nuts.

I think the problem might be some other file in the Windows directory
needs to be present, and it is on some systems but not all. I have
made other dll's that don't have this problem. I'm trying to figure
out if there is some linker option I need to turn on. So far I
haven't found anything. But the more I think about it, the more
convinced I am this is the answer.

Brian

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default problem with "file not found" calling a dll from VBA

Just to be sure, remove the path from the declaration and try something like
this

sPath = "C:\<path\"
sFile = "myApp.dll"

sOldDir = CurDir
ChDir sPath

On Error Resume Next
nAttr = GetAttr(sFile)
bFileExists = (Err.Number = 0) And ((nAttr And VBA.vbDirectory) = 0)
ChDir sOldDir
On Error GoTo 0

If bFileExists Then
' Call your dll function stuff here
Else
MsgBox sPath & sFile & vbCr & "not found"
End If

Regards,
Peter T


"Brian Murphy" wrote in message
...
I've tried all the things you've suggested. That's why I'm going
nuts.

I think the problem might be some other file in the Windows directory
needs to be present, and it is on some systems but not all. I have
made other dll's that don't have this problem. I'm trying to figure
out if there is some linker option I need to turn on. So far I
haven't found anything. But the more I think about it, the more
convinced I am this is the answer.

Brian



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default problem with "file not found" calling a dll from VBA

I essentially have tried exactly that, and it makes no difference.

I'm pretty sure it's a compiler dependency thing?

I just posted my question on comp.lang.fortran
This particular newsgroup has more spam than fortran.
Which is a downright shame.
I wonder how the excel newsgroups avoid this?

Brian


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default problem with "file not found" calling a dll from VBA

I haven't got it fixed yet. But with some help from comp.lang.fortran
I've learned that my dll depends on a file named DFORRTD.DLL.

So I hope to have this fixed later tonight.

Brian
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default problem with "file not found" calling a dll from VBA

My problem is solved. The details are at the following post in the
comp.lang.fortran newsgroup.

http://groups.google.com.na/group/co...ae6d5b2dcf8c42

The "file not found" error 53 was caused by some fortran-compiler-
specific dlls that were needed that I didn't know about. When I
eliminated that, the problem cleared up.

But also the very same error message is triggered if the upper/lower
case of the routine name doesn't match that in the dll.

Cheers,

Brian
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting a "File Not Found" error when trying to show userform Bruce[_2_] Excel Programming 1 June 7th 07 08:30 PM
Getting "compile error" "method or data member not found" on reinstall Bp Excel Programming 1 April 23rd 04 04:42 PM
Problem- Recording macros for "file save" and "File open" tritaco Excel Programming 1 April 22nd 04 06:15 PM
"file not found" error message when launching source file Lisa[_9_] Excel Programming 4 April 6th 04 02:54 PM


All times are GMT +1. The time now is 01:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"