Hi,
I wanted to do the following:
1. Save a file as "Tensegrity.tmp" in my C:\Temp directory (and if one
exists to replace it without any interaction, asking me about it etc.)
2. Once this is done, my application to automatically be minimized.
i.e. in one command, or by the press of one button, my application to save
the file as C:\Temp\Tensegrity.tmp and right after that to be minimized.
I have this so far but all the interaction about where to save the file is
unnecessary to me.
Could someone please help me?
Thanks
J.C.
Private Sub Savetemp_Click()
Dim fs 'As FileSystemObject
Dim OldPath$
OldPath$ = CurDir ' CMDialog will change the current path
Set fs = CreateObject("Scripting.FileSystemObject")
CommonDialog2.Flags = cdlOFNHideReadOnly + cdlOFNExplorer
CommonDialog2.Filter = "*.tmp"
CommonDialog2.Filename = "Tensegrity" ' This is the value returned if
Esc/Cancel
CommonDialog2.ShowSave ' VB 6.0 way to select FileSaveAs
testfile$ = CommonDialog2.Filename ' = "" if the Cancel button is
pressed
If testfile$ <> "" Then
' Check for extension. If it does not exist then insert it.
If GetFileExtension(testfile$) = "Temporary" Then
testfile$ = testfile$ & ".tmp"
End If
saveFile$ = testfile$
' If OverWrite, ask if ok
If Dir(testfile$) <> "" Then
Select Case MsgBox("Overwrite existing file?", vbOKCancel)
Case vbOK
Save (testfile$)
Case Else
Exit Sub
End Select
Else
Save (testfile$)
End If
End If
End Sub