Need Module Help

aftershokk

Registered User.
Local time
Today, 14:51
Joined
Sep 5, 2001
Messages
259
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
 
From VBA Help:

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

Can you send an example?

or

I did create a batch file that works. How would I call the batch file?
 
Did you look in Help? There's an example there. You could call a batch file with Shell.
 
If you set a reference to Microsoft Scripting Runtime, you can also use this:
Code:
    Dim fso As FileSystemObject
    
    Set fso = New FileSystemObject
    fso.MoveFile "C:\Test.dat", "C:\MyTest.txt"
 
Shell "cmd /k ""L:\Med\Data_Transfers\files\rename.bat""", vbNormalFocus

How do I run it within Access?
 
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)
 
You should be able to call it by just:

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

Users who are viewing this thread

Back
Top Bottom