I open a lot of *.txt files. I'd like to make a macro that saves the worksheet as follow:
Main directory: D:\MATLAB\ABR analyse\eABR normal-deaf\
subfolder: part of worksheet name
name: worksheetname
extension: xls
The worksheets are named as follow: param_6jun02-e15-e2a.txt.
The part I want to use for the subfolder name is "param_6jun02"
Is that possible to achieve?
Code:ActiveWorkbook.SaveAs Filename:= _ "D:\MATLAB\ABR analyse\eABR normal-deaf\6jun02\param_6jun02-e15-e2a.xls" _ , FileFormat:=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False
It can be done
Will the macro need to create the sub folder?
Do you use the macro to open the txt file? - If yes post the code that selects & opens the file
Please Read Forum Rules Before Posting
Wrap VBA code by selecting the code and clicking the # icon or Read This
How To Cross Post politely
Top Excel links for beginners to Experts
If you are pleased with a member's answer then use the Scales icon to rate it
If my reply has assistedor failed to assist you
I welcome your Feedback.
I mannualy open the *.txt file. The subfolders already exist, the macro just needs to follow the path. The subfolder name is already in the *.txt filename, so I thought I could use it.
The *.txt files are also already in that subfolder. So it might be possible to save the worksheet in the folder it came from.
Last edited by kjiratsiekoedel; 06-09-2009 at 09:25 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks