Select directory when exporting text

Talismanic

Registered User.
Local time
Today, 13:51
Joined
May 25, 2000
Messages
377
This code allows me to dynamically create the file names for my export based on the date.

Dim dtName As Date
Dim strFName As String

dtName = Date
strFName = "W:\Payroll\PR" & Format(dtName, "mmdd") & ".txt"

' Exports time to listed directory like this PR0425.txt
DoCmd.TransferText acExportDelim, "Bidtek", "BidtekRejoinReport", _
strFName, False

I would like to either prompt the user for a export location or have it allways go to the desktop (preferable). Is it possible to send a file to a users desktop regardless of the users profile path or OS (Windows 9x, Windows 2K).

I mean is there a universal command for sending the file to the current users desktop?

[This message has been edited by Talismanic (edited 04-25-2001).]
 
Thanks Peter D, that was exactly what I was looking for. It was also a reminder about the great Access information that can be found at The Access Web.

By the way, this is how I modified my code to make it work with that module:

Private Sub cmdExport_Click()

' Declare the variable names for the export path
Dim dtName As Date
Dim strFName As String
Dim strFName2 As String
Dim intQuestion As Integer
Dim strFolderName As String

' get the current date
dtName = Date

' Create a path that will use the current date formatted as mmdd with
' .txt as its extension
strFolderName = BrowseFolder("What Folder do you want to select?")


strFName = strFolderName & "\PR" & Format(dtName, "mmdd") & ".txt"
strFName2 = strFolderName & "\TR" & Format(dtName, "mmdd") & ".txt"

' Exports time to listed directory
DoCmd.TransferText acExportDelim, "Bidtek", "BidtekRejoinReport", _
strFName, False
' Check to see if users wants to export time or quite.
intQuestion = MsgBox("Do you want export travel now?", vbYesNo, "Continue?")
If intQuestion = vbYes Then
DoCmd.TransferText acExportDelim, "TravelExport", "TravelReport", _
strFName2, False
Else
Exit Sub
End If
' Let user know that the export is done.
MsgBox "Press OK to finish!", vbOKOnly, "Export Complete"

End Sub
 

Users who are viewing this thread

Back
Top Bottom