Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA to copy CSV to Txt

Status
Not open for further replies.

101287

MIS
Apr 8, 2006
189
US
Need to know if I could use the following code to copy a CSV file to TXT. In other words can I use the code and change the extension. The reason that I'm asking is that once the extension is change I would like to uploaded to access. Suggestion and best practices will be appreciated.

Luis

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Function xCopyITPMODatabase()
Dim strSourceFile As String
Dim strDestinationPath As String

On Error GoTo CopyIT_Exit

' Set the target file path
strSourceFile = "\\ftwss04\is&t_proj_rw\PMO_Public\PublicDashboard.mde"

' Set the target file path
strDestinationPath = "\\ftwgroups\jsf\jsfitcoord\acWKspace\F-35 Dash Board\"

' Check that the source file exists
If Dir(strSourceFile) = vbNullString Then
'The Source File does not exist
GoTo CopyIT_Exit
End If

' Check that the destination folder exists.
If Dir(strDestinationPath) = vbNullString Then
MkDir (strDestinationPath)
End If

' Delete the Destination file if it already exists
strDestinationPath = strDestinationPath & "PublicDashboard.mde"
If Dir(strDestinationPath) <> vbNullString Then
Kill strDestinationPath
End If

'Copy the file
FileCopy strSourceFile, strDestinationPath

CopyIT_Exit:
Const cTIME = 1000 'in MilliSeconds
Call sSleep(cTIME)
DoCmd.Quit

End Function

 
I can't see why it wouldn't work.

Did you try it yourself after making the modifications you suggested to see if it worked?

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Yes I did. It did not work. However, when I'm in excel and save the file as txt (Unicode) and upload the file it works. Is there anyway that I can use the code an specify Unicode Text file. If I'm able to do that the code will work. Other suggestions or any else that I could do?

Thank you for help and collaboration.

Luis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top