File Dialog Save As issue !

achalrikhi

Registered User.
Local time
Today, 15:35
Joined
Jun 7, 2015
Messages
10
Dear Friends,

I am importing a .CSV file into my project, then after editing and alteration through VBA code, I export it in .TXT format.

Till here everything is going fine. What I want is that, when a user exports the file, the FileDialogSaveAs box, must have the initial file name or say preloaded file name must be a name which the user just have chosen to export. i.e. the FileDialogSaveAs box will be having the same name as an option to the user to save the file. In case the user want to save by another name, he can.

At this point in time, this FileDialogSaveAs box have no name in file name space. User have to enter the file name with a .txt extension. Can we avoid this extension thing also ?

Please guide.

I am using the code to export is this :

Private Sub CmdCashTextConvert_Click()

Dim intChoice As Integer
Dim strPath As String


intChoice = Application.FileDialog(msoFileDialogSaveAs).Show

If intChoice <> 0 Then

strPath = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)

Call MsgBox(strPath, vbInformation, "Save Path")

Select Case MsgBox(" Do you want to convert CSV file to text file ?", vbYesNo)
Case vbYes
DoCmd.TransferText acExportDelim, "Cash Export Specification", "Equity", strPath, True

MsgBox (" CSV file converted to text file successfully ")
End Select

DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM TblCash;"
DoCmd.SetWarnings True
End If

End Sub
 
Dear compadre,

I don't think that you can add filters to the SaveAs dialog picker. You can however allow the user to select a folder which is pre-set with the folder of your choice, and in a separate box pre-fill the file name with the .txt extension. The enforcement of .txt would be done in code.
 

Users who are viewing this thread

Back
Top Bottom