Hello!! Hoping to get some more help here..
The code below can save a profile.

If the same filename exists, and the user chooses not to overwrite the file, I want to add -nn (-01, then if still the same filename will be -02, and so on and so forth) to the end of the file before the extension .plp.

example output:
filename.plp
filename-01.plp
filename-02.plp
filename-03.plp ~ filename-99.plp

This is my current code:

VB Code:
  1. Function isFile(ByVal sFileName As String) As Integer
  2.   On Error Resume Next
  3.   Dim lFileLength As Long
  4.   Const ATTR_NORMAL = 0
  5.  
  6.   isFile = False
  7.   If Dir$(sFileName, ATTR_NORMAL) <> "" Then
  8.   lFileLength = FileLen(sFileName)
  9.   If (lFileLength > 0) Then isFile = True
  10.   End If
  11. End Function

VB Code:
  1. Private Sub cmd_ok_Click()
  2. Dim prof As String
  3. Select Case Me.Caption
  4.     Case "Save Profile"
  5.     txt_profilepath.Text = file1.Path & "\" & file1.FileName & txt_plprofile.Text
  6.         If isFile(txt_profilepath.Text) Then
  7.             txt_plprofile.Text = frm_loadfile.var1
  8.             prof = frm_field.GetString(txt_plprofile.Text, "-", "C")
  9.                 If MsgBox("File " & txt_profilepath & " exists.  Do you want to overwrite the current profile?{Y/N]", vbQuestion + vbYesNo, App.ProductName + " Prompt") = vbYes Then
  10.                     SaveProfile txt_profilepath.Text, pl1
  11.                 Else
  12.                     txt_profilepath.Text = file1.Path & file1.FileName & "\" & prof & "-02" & ".plp"
  13.                     SaveProfile txt_profilepath.Text, pl1
  14.                 End If
  15.         Else
  16.             MsgBox "Saving " & txt_profilepath & " as new profile."
  17.             SaveProfile txt_profilepath.Text, pl1
  18.         End If
  19.  
  20.         profilepath = txt_profilepath.Text
  21.         frm_field.cmd_next.Enabled = True
  22.  
  23.     Case "Load Profile"
  24.         txt_profilepath.Text = file1.Path & "\" & file1.FileName
  25.         MsgBox "Loading " & txt_profilepath & " profile."
  26.             LoadProfile txt_profilepath.Text, pl1
  27.         profilepath = txt_profilepath.Text
  28.         frm_field.cmd_next.Enabled = True
  29. End Select
  30.     Me.Hide
  31. End Sub

HELP!!..