Hiya – I have code which checks if a directory exists
if not then create the directory folder.
then continue & proceed to perform code.
please see code below.
On a small percentage of the pc’s – whats happening is
although the directory is created on the users C drive – C:TempConvert
when the function blnFolderExists(strFolderName) runs – its returning a false value
as then generates a ‘VB runtime error message 91. Object variable or With block variable not set’.
We have winNT4.0 – do you think this is a windows NT rights issue?
as its not passing the correct value back to the code?
Or could it be a word setup ie a reference is missing?
should I just amend code to perform a workaround?
tia Diana
‘check if folder exists –
‘if folder doesnt exist create directory folder & hide folder(so user cant see folder)
strTempFolder = “C:TempConvert”
If Not blnFolderExists(strTempFolder) Then
MkDir strTempFolder
SetAttr “C:TempConvert”, vbHidden ‘ Set folder with hidden attribute.
End If
”””””””””””””””””””””””””””””””””””””””””””””””
‘Function: blnFolderExists(strFolderName) As Boolean
‘Purpose: checks if folder exists
‘Inputs: pass in name of folder/directory to check.
‘Returns: true or false in boolean status – blnFolderExists.
”””””””””””””””””””””””””””””””””””””””””””””””
Function blnFolderExists(strFolderName) As Boolean
blnFolderExists = CBool(Len(Dir(strFolderName, vbDirectory)))
End Function