7 replies
by john_wills
Private Sub ExportToText(SourceTable As String, PaymentKind As String, _
OutFileName As String, collapsed As Boolean)
Const sFn = "ExportToText"
Dim vStat As Variant
On Error GoTo ExportToText_Err
Me.cdlgExport.Flags= cdlOFNHideReadOnly
Me.cdlgExport.DefaultExt = ".txt"
Me.cdlgExport.Filter = "Text Files (*.txt)|*.txt"
Me.cdlgExport.FilterIndex = 1
Me.cdlgExport.InitDir = "U:\cc3 Transfer\AccessDatabases\"
Me.cdlgExport.FileName = ""
Me.cdlgExport.ShowSave
OutFileName = Me.cdlgExport.FileName
DoCmd.Hourglass True
DoCmd.TransferText acExportFixed, PaymentKind, SourceTable, OutFileName
DoCmd.Hourglass False
DoCmd.OpenForm "frmViewCTLFile", acNormal, , , , acDialog, OutFileName
ExportToText_Exit:
Exit Sub
ExportToText_Err:
ErrorMsg "Error in SubRoutine: '" & sFn & "', Module: '" & msDocName & "'", Err.Number, Err.Description
collapsed = True
Resume ExportToText_Exit
End Sub
cdlgExport is an ActiveX object of OLE class CommonDialog. To define the format of the output file, named in PaymentKind, You can use the Import or Link Tables subcommand of the Get External Data command or the Save As/Export command on the File menu to create a specification for a particular type of text file, such as a delimited text file that uses tabs to separate fields and has an MDY format for dates. When you click one of these commands and select a type of text file to import, export, or link, the Import Text Wizard, Export Text Wizard, or Link Text Wizard runs. You can click the Advanced button in the wizard and define and save a specification in the dialog box that appears. You can then type the specification name in this argument whenever you want to import or export the same type of text file.
by mk1
by bristar
Umm....Ahem...it's not nearly THAT complicated.
Just put a ", False" after your text file name.
by mk1
by miss kitty
Or walk through the export and create a export specification for it and don't select include headings. Then set up a macro to export it for you and use the export specification. Works for me.
Cathy
by mk1
by mk1
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending