hufada
Jun 19th, 2006, 10:10 AM
HI, all, I tried to export part of the excel sheet to a text file. I used the folowing code, With Application.GetSaveAsFilename(), someone has to click on the "SAVE" button in the pop-up window. Is there a way I can save the text file without the click?
Thank you very much.
Public Sub Dotheexport()
Dim FName As Variant
Dim Sep As String
FName = Application.GetSaveAsFilename("C:\Documents and Settings\xyz\Desktop\Data.txt")
If FName = False Then
MsgBox "You didn't select a file"
Exit Sub
End If
Sep = " "
'Sep = InputBox("Enter a single delimiter character (e.g., comma or semi-colon)", _
"Export To Text File")
ExportToTextFile CStr(FName), Sep, _
False
End Sub
Thank you very much.
Public Sub Dotheexport()
Dim FName As Variant
Dim Sep As String
FName = Application.GetSaveAsFilename("C:\Documents and Settings\xyz\Desktop\Data.txt")
If FName = False Then
MsgBox "You didn't select a file"
Exit Sub
End If
Sep = " "
'Sep = InputBox("Enter a single delimiter character (e.g., comma or semi-colon)", _
"Export To Text File")
ExportToTextFile CStr(FName), Sep, _
False
End Sub