Brian,
Try adding:
oSaveasDialog:SetStyle( OFN_OVERWRITEPROMPT, TRUE)
I think this is the correct value. with it Windows will do th checking
for you and prompt the user if it exists.
Another useful, for opening files, is OFN_FILEMUSTEXIST, which only
allows Open to be pressedd if the specified exists.
Hope this helps.
Kevin
brian@[EMAIL PROTECTED]
wrote:
> Hi,
>
> I have code to save file (see below) but I dont know how to check if a
> file with the same name already exists in that folder to warn user.
>
> Any help please.
>
>
> oSaveAsDialog:=SaveAsDialog{ , CSVName()}
> oSaveAsDialog:Caption:="Save As"
> oSaveAsDialog:SetStyle(OFN_ALLOWMULTISELECT,FALSE)
> oSaveAsDialog:InitialDirectory := aPath[1]
> oSaveAsDialog:SetFilter({"*.CSV"},{"CSV Only"})
> action:= oSaveAsDialog:Show()
>
> uFileName := oSaveAsDialog:FileName
> nPos := RAt('.',uFileName)
>
> IF uFileName != NULL_STRING
>
> cExt := Left(uFileName,nPos) //Get file name and path left of
> extension
> oSelf:cFileName := cExt+'CSV' //Force CSV on extension if user
> enters something else
>
> lFileSelected := TRUE
> ELSE
> lFileSelected := FALSE
> ENDIF
>
> RETURN lFileSelected


|