Rename a .dat file

G

Guest

I need to rename a .dat file to a .csv file so I can work with it in Access
2003. The following code does not work... any ideas what I should do?


Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Function ChangeFile()
x = Shell("ren C:\myfolder\weborders.dat weborders.csv")
Sleep (8000)

End Function
 
G

Guest

Hi

Just use the Name method:

Function ChangeFile()
Name "C:\myfolder\weborders.dat" As "C:\myfolder\weborders.csv"
End Function

Nor sure why you have the sleep command though!

Cheers.

BW
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top