# Declarations

Code:
Public Msg As String
Public MsgBtn As Integer
Public MsgTitle As String
Public MsgId As Integer


# Miscellaneous

Code:
Sub BubbleSort(Ary() As Variant)
    'You need to change As Vaitent to As WhateverType you want
    Dim Low As Integer, High As Integer, i As Integer, j As Integer
    Dim Temp As Variant
    Low = LBound(Ary)
    High = UBound(Ary)
    For i = Low To High
        For j = Low To High
            If Ary(j) > Ary(i) Then
                Temp = Ary(j)
                Ary(j) = Ary(i)
                Ary(i) = Temp
                End If
            Next j
        Next i
End Sub


# Types

Code:
Type Point
	x As Long
	y As Long
	End Type


Code:
Type Rect
	Left As Long
	Top As Long
	Right As Long
	Bottom As Long
	End Type


# File I/O

Description:
Get File Name with Common Dialog Control

Code:
Function GetFileName(c As CommonDialog, ByVal Act As Integer, ByVal IniDir As String, ByVal DefFileName As String, ByVal DefExt As String, ByVal Fltr As String) As String
    'c: Common Dialog control
    'Act: 1 = Open, 2 = Save,
    'DefExt: Default Extension. Do not include preceding "*." - Can Be ""
    'Fltr: Various Extensions allowed "Description|Extension|Description|Fileter..." Include "*." - Can be ""
    'DefFileName:  Initial file name to use in dialog - Can be ""
    'IniDir: Initial startup directory - can be ""
    
    GetFileName = ""
    On Error GoTo GetFileNameError
    c.CancelError = True
    If Trim(Fltr) = "" Then Fltr = "All Files|*.*"
    If Act = 2 Then
        c.DialogTitle = "Save As"
        c.DefaultExt = DefExt
        c.Filter = Fltr
        c.filename = DefFileName
        c.Flags = cdlOFNHideReadOnly + cdlOFNOverwritePrompt
    Else
        c.DialogTitle = "Open"
        c.DefaultExt = DefExt
        c.Filter = Fltr
        c.filename = DefFileName
        c.Flags = cdlOFNHideReadOnly + cdlOFNFileMustExist
        End If
    c.InitDir = IniDir
TryAgain:
    If Act = 2 Then
        c.ShowSave
    Else
        c.ShowOpen
        End If
    If (c.Flags And cdlOFNExtensionDifferent) Then 'This only works 100% with 16 bit VB
        MsgBox UCase(c.filename) & vbCrLf & "The file is not of the correct type (*." & c.DefaultExt & ").", 64, "Error"
        c.filename = ""
        GoTo TryAgain
        End If
    GetFileName = c.filename
    
ExitGetFileName:
    On Error GoTo 0
    Exit Function

GetFileNameError:
    If Err = cdlCancel Then
        'Do Nothing
    Else
        MsgBox Error(Err) & ".", 48, "Error"
        End If
    Resume ExitGetFileName
    
End Function


# Information

Code:
This file was created on 05/26/95
by Ronald K. King
For questions or comments contact me at
74167.2312.Compuserve.com

Use the information contained in this
file a your own risk.


