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
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