I’m trying to pass variable values from a list box to GetFolderItem() without success. What is the correct syntax?
dim f as New folderitem
f=GetFolderItem(CurrentBook).Child(CurrentBook).Child(CurrentChapter).Child(CurrentVerse)
if f.exists then
msgBox(“File exists”)
end if
The error returned is: NilObjectException
The variables are initialized with values in the Change event of a listbox
dim f as New folderitem
//f=GetFolderItem(CurrentBook).Child(CurrentBook).Child(CurrentChapter).Child(CurrentVerse)
f=GetFolderItem(“01_Genesis”).Child(“01_Genesis”).Child(“01_Genesis_001”).Child(“0001.mp3”)
if f.exists then
msgBox(“File exists”)
end if
msgbox(CurrentBook+" “+CurrentChapter+” "+CurrentVerse)
The f.exist returns true for the modified GetFolderItem() to include “text strings”
The msgBox() returns “01_Genesis” “01_Genesis_001” “0001.mp3”
I try to understand what I can but sometimes I don’t worry about it. I moved the routine to a method with the parameters
needed; cb as string, cc as string, cv as string.
Then on the change event pass the data to the method.
One of my issues was that I need to test that any of the passed parameters was actually populated.
You need to put it in a try catch because if it’s more than one level invalid you’re going to get the nilobjectexception instead of the false .exists result.