Hi, I'm stuck trying to diagnose the below code, the error "Compile error: ByRef argument type mismatch in VBA" occurs at the line If FileOrDirExists(htmpath) = True Then fso.DeleteFile (htmpath)
Can anyone help? Many thanks...
Function FileOrDirExists(PathName As String) As Boolean
Dim iTemp As Integer
On Error Resume Next
iTemp = GetAttr(PathName)
Select Case Err.Number
Case Is = 0
FileOrDirExists = True
Case Else
FileOrDirExists = False
End Select
On Error GoTo 0
End Function
Sub expgraphs()
Dim fso
Dim exppath, filname, htmpath, folderpath As String
exppath = "C:\Documents and Settings\art\Desktop\MA BINC\graphs\"
filname = Left(ThisWorkbook.Name, (Len(ThisWorkbook.Name)) - 4)
htmpath = exppath & filname & ".htm"
htmpath = htmpath
MsgBox (htmpath)
Set fso = CreateObject("Scripting.FileSystemObject")
If FileOrDirExists(htmpath) = True Then fso.DeleteFile (htmpath)
End Sub
Regards, Alan
Can anyone help? Many thanks...
Function FileOrDirExists(PathName As String) As Boolean
Dim iTemp As Integer
On Error Resume Next
iTemp = GetAttr(PathName)
Select Case Err.Number
Case Is = 0
FileOrDirExists = True
Case Else
FileOrDirExists = False
End Select
On Error GoTo 0
End Function
Sub expgraphs()
Dim fso
Dim exppath, filname, htmpath, folderpath As String
exppath = "C:\Documents and Settings\art\Desktop\MA BINC\graphs\"
filname = Left(ThisWorkbook.Name, (Len(ThisWorkbook.Name)) - 4)
htmpath = exppath & filname & ".htm"
htmpath = htmpath
MsgBox (htmpath)
Set fso = CreateObject("Scripting.FileSystemObject")
If FileOrDirExists(htmpath) = True Then fso.DeleteFile (htmpath)
End Sub
Regards, Alan