-
Hi all,
I am new at this and really don't know how to use a
dialog box to save a file as. I found a sample to
open a file, but not a save as.
Here is a sample code:
Private Sub Command1_Click()
' IS THIS SUPPOSED TO SWITCH TO SAVE AS?
CommonDialog1.Flags = cdlOFNCreatePrompt
' default directory
CommonDialog1.InitDir = App.Path
CommonDialog1.Filter = "All Files (*.*)|*.*|Text " & _
" Files (*.txt)|*.txt|Batch Files (*.bat)|*.bat"
' Specify default filter.
CommonDialog1.FilterIndex = 2
' Display the Open dialog box.
CommonDialog1.ShowOpen
' Call the open file procedure.
' OpenFile (CommonDialog1.filename)
fileout = CommonDialog1.FileName
End Sub
-
I think you should use this instead to save
CommonDialog1.ShowSave
although, the dialogs are the same you don't want it to be titled "open file".
The difference between save and save as isn't the dialog, to show the save dialog is to save as, and the exception of it is save, when you already have the filename. therefore when you choose save you check for the length of the filename property and open it only when it's 0.
-
Thanks Kedaman
You have been very helpful to me. Perhaps someday when
I know a little more about VB, and make lot$ of money,
we can meet and have some beer.
Until then, you make it a good weekend, and thanks again.
-