code is not working.
The function doesn't return a value and if on a worksheet will not run since
no parameter is pass to the function. worksheet functions only get called
when a dependency is updated. The dependency is the passed parameter which
doesn't exist.
Function PathAndName() As Boolean
Dim WBPath As String
WBPath = ThisWorkbook.Sheets("Data").Range("B3").Value
'the string length is more the 100 carectors in length.
If ThisWorkbook.Path < WBPath Then
MsgBox "This workbook is not correct path."
PathAndName = False
else
PathAndName = True
End If
End Function
I would change the code to pass B3
=PathAndName(Data!B3)
Function PathAndName(WBPath as string) As Boolean
'the string length is more the 100 carectors in length.
If ThisWorkbook.Path < WBPath Then
MsgBox "This workbook is not correct path."
PathAndName = False
else
PathAndName = True
End If
End Function
"Heera Chavan" wrote:
Hi All,
This code checks the file path of workbook as it should be always on shared
drive.
Function PathAndName() As Boolean
Dim WBPath As String
WBPath = ThisWorkbook.Sheets("Data").Range("B3").Value
'the string length is more the 100 carectors in length.
If ThisWorkbook.Path < WBPath Then
MsgBox "This workbook is not correct path."
Exit Function
End If
End Function
This small funtion is troubling me a lot. It works on some machines and it
doesnt work on some. Some times it works on my machine and some times i
doesnt.
Kindly help
Heera Chavan
|