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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macro/VB code 1

Status
Not open for further replies.

482570

Technical User
Apr 15, 2007
6
US
I'm novice user and macro program and I needs help to figure out how to move the file from one location to other done by macro.
Currently import text file(Data.NC), copy and paste to excel file.
after paste to excel, I need to move text file(Data.NC) to differnt location for next repeat process.
Text file name change each time for ID purpose, hard time run macro so move file location is one way.

other way is save the text file by user define save as during macro run time which I have not been able to do this task. as follow code used,

Dim Newbook As Workbook
Dim fName As Variant
|Set NewBook = Workbooks.Add Do
fName = Application.GetSaveAsFilename
Loop Until fName <> False
NewBook.*SaveAs* Filename:=fName

This only add new book not the Data.NC.
I don't know how to motify this code point to text file.
please someone help me on this?
I'm running MS office 97.

Thank you all
 
To import text, try DoCmd.TransferText Then fill in the rest of the required information based on your needs. The help file has examples, and there are probably plenty of examples here in the forums.

--

"If to err is human, then I must be some kind of human!" -Me
 
Hi,

you can move files from one folder to another useing:

Code:
CreateObject("Scripting.FileSystemObject").MoveFile Source, Destination

With Source being the full name of the file to move (Full Name of Data.NC) and Destination being full name of the file once moved (i.e. Data.NC preceded by the path of the folder you want to move it to)

Cheers,

Roel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top