Hi,
I need to browse and open a folder to store a file. I am using the automation 'Microsoft Shell Controls And Automation'.Shell for this purpose.
It works well when I select the folder and click Ok. However if I browse and then click cancel, i am getting an error message
Below is the code :
IF ISCLEAR(ShellControl) THEN
CREATE(ShellControl);
Folder := ShellControl.BrowseForFolder(0,'',0);
FolderItems := Folder.Items();
FolderItem := FolderItems.Item;
"Archived Filename" := FORMAT(FolderItem.Path);
CLEAR(ShellControl);
Name DataType Subtype Length
ShellControl Automation 'Microsoft Shell Controls And Automation'.Shell
Folder Automation 'Microsoft Shell Controls And Automation'.Folder3
FolderItems Automation 'Microsoft Shell Controls And Automation'.FolderItems3
FolderItem Automation 'Microsoft Shell Controls And Automation'.FolderItem2
Anyone has a solution?
Thanks
Regards,
Sunil
0
Answers
It worked well.
Regards
Sunil
CREATE(ShellControl);
Folder := ShellControl.BrowseForFolder(0,'',0);
IF NOT ISCLEAR( Folder ) THEN BEGIN
FolderItems := Folder.Items();
FolderItem := FolderItems.Item;
"Archived Filename" := FORMAT(FolderItem.Path);
END;
CLEAR( ShellControl );
CLEAR( Folder );
CLEAR( FolderItems );
CLEAR( FolderItem );