L
Lars Hostrup
I'am using "transfer" text to create a text file based on a query. In stead
of having af "fixed" filename for the output file, I would like to build a
small routine that gives the file a name based on todays date i.e.
11072007.txt.
I need help to solve this issue and hope someone can help me!
Lars
-----------------------------------
Private Sub Label26_DblClick(Cancel As Integer)
Dim oApp As Object
Dim ExcelWasNotRunning As Boolean
Dim Msg, Style, Title, Response, MyString
Dim SourceFile, Destinationfile
'export af betalinger til CSV-fil
DoCmd.TransferText acExportDelim, "factoringfile", "Betalinger",
"K:\All\Koncern\betalingsfiler\Betalinger.txt"
DoCmd.TransferText acExportDelim, , "Betalinger",
"K:\All\Koncern\betalingsfiler\Betalinger.csv"
'kopier fil
SourceFile = "K:\All\Koncern\Betalingsfiler\betalinger.txt"
Destinationfile =
"K:\All\Koncern\Betalingsfiler\book\betalingersendt.txt"
FileCopy SourceFile, Destinationfile
'Kør excel for at vise filen
'Msg = "Do you want to Continue?"
'Style = vbYesNo + vbDefaultButton2
'Title = "MsgBox"
'Response = MsgBox(Msg, Style, Title)
'If Responce = vbYes Then
On Error Resume Next
Set oApp = GetObject(, "Excel.Application")
If Err.Number <> 0 Then ExcelWasNotRunning = True
Err.Clear
Set oApp =
GetObject("K:\All\Koncern\betalingsfiler\Betalinger.csv")
oApp.Application.Visible = True
oApp.Parent.Windows(1).Visible = True
'Only XL 97 supports UserControl Property
oApp.UserControl = True
'Else
Exit_runExcel_Click:
Exit Sub
MsgBox ("file created"), vbInformation
'End If
'transfer_error:
' MsgBox "error in fil transfer", vbOKOnly
End Sub
of having af "fixed" filename for the output file, I would like to build a
small routine that gives the file a name based on todays date i.e.
11072007.txt.
I need help to solve this issue and hope someone can help me!
Lars
-----------------------------------
Private Sub Label26_DblClick(Cancel As Integer)
Dim oApp As Object
Dim ExcelWasNotRunning As Boolean
Dim Msg, Style, Title, Response, MyString
Dim SourceFile, Destinationfile
'export af betalinger til CSV-fil
DoCmd.TransferText acExportDelim, "factoringfile", "Betalinger",
"K:\All\Koncern\betalingsfiler\Betalinger.txt"
DoCmd.TransferText acExportDelim, , "Betalinger",
"K:\All\Koncern\betalingsfiler\Betalinger.csv"
'kopier fil
SourceFile = "K:\All\Koncern\Betalingsfiler\betalinger.txt"
Destinationfile =
"K:\All\Koncern\Betalingsfiler\book\betalingersendt.txt"
FileCopy SourceFile, Destinationfile
'Kør excel for at vise filen
'Msg = "Do you want to Continue?"
'Style = vbYesNo + vbDefaultButton2
'Title = "MsgBox"
'Response = MsgBox(Msg, Style, Title)
'If Responce = vbYes Then
On Error Resume Next
Set oApp = GetObject(, "Excel.Application")
If Err.Number <> 0 Then ExcelWasNotRunning = True
Err.Clear
Set oApp =
GetObject("K:\All\Koncern\betalingsfiler\Betalinger.csv")
oApp.Application.Visible = True
oApp.Parent.Windows(1).Visible = True
'Only XL 97 supports UserControl Property
oApp.UserControl = True
'Else
Exit_runExcel_Click:
Exit Sub
MsgBox ("file created"), vbInformation
'End If
'transfer_error:
' MsgBox "error in fil transfer", vbOKOnly
End Sub