The CyberSecretary Object Library includes a number of built-in methods for working with files, to perform tasks which would otherwise require Windows API calls.

.PickFile "EXT", "FilePath", CS_OPEN |CS_SAVE

This function displays a Windows 95/98 common dialog (Open or Save As) which can be used to select a file name, and returns the file name selected by the user.  You may specify the default extension and file filter, as well as the default path.

sFileName = MySecretary.GetFileName "TXT", "c:\Windows", CS_OPEN

.PickFolder "DefaultPath"

This function displays a list of drives and folders in the CyberSecretary dialog box, and allows the user to select any existing folder, which is returned as a string value.  Please note that you should set the CyberSecretary message and icon before invoking this function.

.OpenFile "Filename"

This method opens the specified file using the application associated with the file type (for example, an .XLS file will be opened in Microsoft Exccel).  This is the same as right-clicking on the specified file and choosing Open.

.PrintFile "Filename"

This method prints the specified file using the application associated with the file type (for example, an .XLS file will be printed using Microsoft Excel).  This is the same result as right-clicking on the specified file and choosing Print.

.EditFile "Filename"

This method opens the specified file for editing.  It is the same as right-clicking on the file and choosing Edit.  It is most useful for types of files that have separate actions defined for editing and opening, e.g. Registry files (.REG) and MS-DOS batch files (.BAT).

.ViewFile "Filename"

This method causes a file to be displayed using a viewer specified in the Registry.  By default, text files are viewed using WordPad, and binary files (including rich text and HTML files) are viewed using QuickView.  You can, however, change these settings by editing the Binary Viewer and Text Viewer values under the Registry key HKEY_CURRENT_USER\ Software\ VB and VBA Program Settings\ CyberSecretary\General