ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   dll in VBA (https://www.excelbanter.com/excel-programming/277808-dll-vba.html)

jacob[_3_]

dll in VBA
 
Hi,
Have made something in c++ to convert a unix file to
dos format. I declare the function in a module using

Declare Function Unix2dos Lib "unixconvert.dll" _
(ByVal InputFile As String, ByVal OutputFile As String)
As Long

and then reference the dll in References under the tools
menu. I then call the function in a sub in the same
module containing the Declare statement using

ConvertStatus = Unix2dos(FileIn, FileOut)

and get Err=53, i.e. file not found. What could be wrong,
excepting typos?

Any help appreciated.

jacob

Chip Pearson

dll in VBA
 
Jacob,

Referencing a DLL has nothing to do with using Declare. You don't need to
reference the DLL. However, in the declare statement, you need to provide
the full path name to the DLL, or locate the DLL in the system directory,
Excel's directory, or a directory named in the PATH environment directory.
Otherwise, the file will not be found, as you have found out.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com



"jacob" wrote in message
...
Hi,
Have made something in c++ to convert a unix file to
dos format. I declare the function in a module using

Declare Function Unix2dos Lib "unixconvert.dll" _
(ByVal InputFile As String, ByVal OutputFile As String)
As Long

and then reference the dll in References under the tools
menu. I then call the function in a sub in the same
module containing the Declare statement using

ConvertStatus = Unix2dos(FileIn, FileOut)

and get Err=53, i.e. file not found. What could be wrong,
excepting typos?

Any help appreciated.

jacob




jacob[_4_]

dll in VBA
 
And then everything worked beautifully. Made my day,
thanks for your time.
-----Original Message-----
Jacob,

Referencing a DLL has nothing to do with using Declare.

You don't need to
reference the DLL. However, in the declare statement,

you need to provide
the full path name to the DLL, or locate the DLL in the

system directory,
Excel's directory, or a directory named in the PATH

environment directory.
Otherwise, the file will not be found, as you have found

out.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com



"jacob" wrote in message
...
Hi,
Have made something in c++ to convert a unix file to
dos format. I declare the function in a module using

Declare Function Unix2dos Lib "unixconvert.dll" _
(ByVal InputFile As String, ByVal OutputFile As String)
As Long

and then reference the dll in References under the

tools
menu. I then call the function in a sub in the same
module containing the Declare statement using

ConvertStatus = Unix2dos(FileIn, FileOut)

and get Err=53, i.e. file not found. What could be

wrong,
excepting typos?

Any help appreciated.

jacob



.



All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com