achalrikhi
New Member
- Joined
- Nov 20, 2013
- Messages
- 38
Dear Friends,
Hello, I have a project. In that I am importing a csv file, change all the necessary alteration and export it in a txt format. Everything is going just fine.
This is what actually happens :
I have imported a .CSV file by " xxx " name. Now when I export it in a .txt format, the user need to put a name with ".txt" at the end of the file name.
What I want :
When a user exports the file in a .txt format, the " FileDialogSaveAs " box should come with a SAME file name which was the name of the IMPORTED file which was a .CSV.
I am using the code is :
Private Sub CmdCashTextConvert_Click()
Dim intChoice As Integer
Dim strPath As String
'make the file dialog visible to the user
intChoice = Application.FileDialog(msoFileDialogSaveAs).Show
'determine what choice the user made
If intChoice <> 0 Then
'get the file path selected by the user
strPath = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
'displays the result in a message box
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
Please guide
Thanks & Regards
Achal
Hello, I have a project. In that I am importing a csv file, change all the necessary alteration and export it in a txt format. Everything is going just fine.
This is what actually happens :
I have imported a .CSV file by " xxx " name. Now when I export it in a .txt format, the user need to put a name with ".txt" at the end of the file name.
What I want :
When a user exports the file in a .txt format, the " FileDialogSaveAs " box should come with a SAME file name which was the name of the IMPORTED file which was a .CSV.
I am using the code is :
Private Sub CmdCashTextConvert_Click()
Dim intChoice As Integer
Dim strPath As String
'make the file dialog visible to the user
intChoice = Application.FileDialog(msoFileDialogSaveAs).Show
'determine what choice the user made
If intChoice <> 0 Then
'get the file path selected by the user
strPath = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
'displays the result in a message box
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
Please guide
Thanks & Regards
Achal