GetFolderItem not working

I have simple code, below

[code]
IF RIGHT(ThisPathName, 1) <> “” THEN
ThisPathName = ThisPathName + “”
END IF

ThisFilePath = ThisPathName + ThisFileName

MsgBox (ThisFilePath)

OpenFile = GetFolderItem(ThisFilePath, FolderItem.PathTypeAbsolute)

IF OpenFIle <> Nil THEN
Pic = Picture.Open(OpenFile)
Pic = ResizeToFit(Pic,ImageWell1.WIdth, ImageWell1.Height)
ImageWell1.Image = Pic
ELSE
MsgBox (“Bad File Name”)
END IF[/code]

I have confirmed through MsgBox that the path and file name are correct, but the GetFolderItem returns Nil. The code trips the MsgBox at the end - Bad File Name. Nothing seems to work. Any help would be appreciated.

What is ThisPathName then this code is executed?

Since AbsolutePath is deprecated, you ought to be using NativePath or ShellPath anyway.

Try

OpenFile = GetFolderItem(ThisFilePath, FolderItem.PathTypeNative)

plus

Pic = Picture.Open(OpenFile,Folderitem.PathTypeNative)

GetFolderItem returns Nil

Did you check that the ThisPathName refers to a real folder?
Where do you get ThisPathName from?

Try:

dim parnt as folderitem = getfolderitem(ThisPathName)
if parnt = nil then
msgbox "Dont like that path!"
else
OpenFile = parnt.child(ThisFileName)
if openfile <> nil and openfile.exists then
Pic = Picture.Open(OpenFile)
Pic = ResizeToFit(Pic,ImageWell1.WIdth, ImageWell1.Height)
ImageWell1.Image = Pic
else
msgbox "Dont like the file!"
end if
end if