Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default UDF & Add-in Issue

All -

I have a UDF that works fine in a regular Excel workbook module. However,
when I convert the excel workbook into an add-in the function no longer
works. I copied it back to a regular Excel module and it works fine. What
am I doing wrong with the conversion of the function to the Add-in?

Here is the function:

Function DoesFileExist (PathFileName as String) as Boolean

On Error GoTo FileDoesNOTExist

If Len(PathFileName) then
If (GetAttr(PathFileName) and vbDirectory) < 1 then
DoesFileExist = True
End if
End if

Exit Function

FileDoesNOTExist:
DoesFileExist = False

End Function

My other UDF work just fine in the Add-in.
Thanks for any help you can give me.

MSweetG222

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default UDF & Add-in Issue

Option Explicit
Sub test()
MsgBox FileExists("C:\Rubbish.xls")
End Sub


Function FileExists(sFileName As String) As Boolean

FileExists = Not ( Dir( sFileName ) = "" )

End Function

"MSweetG222" wrote:

All -

I have a UDF that works fine in a regular Excel workbook module. However,
when I convert the excel workbook into an add-in the function no longer
works. I copied it back to a regular Excel module and it works fine. What
am I doing wrong with the conversion of the function to the Add-in?

Here is the function:

Function DoesFileExist (PathFileName as String) as Boolean

On Error GoTo FileDoesNOTExist

If Len(PathFileName) then
If (GetAttr(PathFileName) and vbDirectory) < 1 then
DoesFileExist = True
End if
End if

Exit Function

FileDoesNOTExist:
DoesFileExist = False

End Function

My other UDF work just fine in the Add-in.
Thanks for any help you can give me.

MSweetG222

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default UDF & Add-in Issue

Thank you for your assistance!!

--
Thx
MSweetG222



"Patrick Molloy" wrote:

Option Explicit
Sub test()
MsgBox FileExists("C:\Rubbish.xls")
End Sub


Function FileExists(sFileName As String) As Boolean

FileExists = Not ( Dir( sFileName ) = "" )

End Function

"MSweetG222" wrote:

All -

I have a UDF that works fine in a regular Excel workbook module. However,
when I convert the excel workbook into an add-in the function no longer
works. I copied it back to a regular Excel module and it works fine. What
am I doing wrong with the conversion of the function to the Add-in?

Here is the function:

Function DoesFileExist (PathFileName as String) as Boolean

On Error GoTo FileDoesNOTExist

If Len(PathFileName) then
If (GetAttr(PathFileName) and vbDirectory) < 1 then
DoesFileExist = True
End if
End if

Exit Function

FileDoesNOTExist:
DoesFileExist = False

End Function

My other UDF work just fine in the Add-in.
Thanks for any help you can give me.

MSweetG222

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
same issue Dink Charts and Charting in Excel 1 October 3rd 09 10:40 AM
Sum Issue Help! [email protected] Excel Discussion (Misc queries) 3 January 24th 07 08:30 PM
Issue with zero/# issue!! drvortex Excel Worksheet Functions 4 December 6th 05 06:22 PM
With and End With issue Pat Excel Programming 4 May 3rd 05 10:20 PM
VBE Issue Seth[_5_] Excel Programming 1 November 11th 03 06:31 PM


All times are GMT +1. The time now is 01:21 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"