View Full Version : Need Module Help


aftershokk
04-10-2007, 07:12 AM
I am really poor with VBA. Here is my request.

I have a bunch of files I FTP monthly. They land as .dat files.

Example: member_data.dat

Currently, I manually rename in Windows Explorer and then I use a macro to import the .txt file.

Is there a way to have a module perform the rename?

thanks to all!

:p

pbaldy
04-10-2007, 07:37 AM
From VBA Help:

The Name statement renames a file and moves it to a different directory or folder, if necessary.

aftershokk
04-10-2007, 07:41 AM
Can you send an example?

or

I did create a batch file that works. How would I call the batch file?

pbaldy
04-10-2007, 07:44 AM
Did you look in Help? There's an example there. You could call a batch file with Shell.

boblarson
04-10-2007, 07:46 AM
If you set a reference to Microsoft Scripting Runtime, you can also use this:

Dim fso As FileSystemObject

Set fso = New FileSystemObject
fso.MoveFile "C:\Test.dat", "C:\MyTest.txt"

aftershokk
04-10-2007, 07:55 AM
Shell "cmd /k ""L:\Med\Data_Transfers\files\rename.bat""", vbNormalFocus

How do I run it within Access?

aftershokk
04-10-2007, 08:57 AM
I just do not know how to call the shell in access?

I created a module that looks like this.

Option Compare Database

Call Shell(Environ$("COMSPEC") & " /l l:\Med\Data_Transfers\T\rename.bat", vbNormalFocus)

boblarson
04-10-2007, 09:03 AM
You should be able to call it by just:

Shell "I:\Med\Data_Transfers\T\rename.bat"

MicroE
04-13-2007, 04:37 PM
Check out: FTP function (http://www.myaccesstips.com/Functionality/ftp.html)