' Name: NewFileSaveAs
' Description:
'   Example replacement for FileSaveAs macro.  Uses COMMDLG to Allow 
'	selection of personalized file type extensions.
'   To use it, copy the macro to your FileSaveAs macro and customize
'	it suit your needs.
'   Requires CommLib macro to be installed globally.
'
' Copyright 1993 Artemis Associates, San Jose, CA


Sub MAIN
	fname$ = ""		' No Initial Filename
	dir$ = ""		' No Initial Directory

	' Filter of File Type to look for
	filt$ = "Contracts (*.cnt)|*.cnt"
	filt$ = filt$ + "|Letters (*.let)|*.let"
	filt$ = filt$ + "|Invoices (*.inv)|*.inv"
	filt$ = filt$ + "|All Files (*.*)|*.*"
	title$ = "New File Open - COMMDLG"

	' Flags for dialog box characteristics
	OFN_OVERWRITEPROTECT = 2
	OFN_PATHMUSTEXIST = 2048
	flags = OFN_OVERWRITEPROTECT + OFN_PATHMUSTEXIST

	' Use Function 1 for FileOpen
	fname$ = CommLib.GetFileDlg$(1, dir$, fname$, filt$, title$, flags)

	If fname$ = "" Then Goto Bye
	On Error Goto ErrSave

	FileSaveAs .Name = fname$
	Goto Bye

ErrSave:
	msg$ = "Error Saving File, " + fname$
	r = MsgBox(msg$, "New File SaveAs", 16)
Bye:
End Sub

