PathExists = (GetAttr(pName) And vbDirectory) = vbDirectory MsgBox ("Number of Fragment Files processed: " & book_counter)įunction verify_folder(path As String) As String 'Do stuff here (this just prints the file name) Workbooks.Open Filename:=folder_path & sWB_name Sub process_folder()ĭim pWB As Workbook, sWB As Workbook, sWB_name As String It then checks to make sure the path is valid and then loops through each file does something, closes the file and at the end it prints the number of files opened. The folder path is hard coded in the macro (this could be changed to bring up a folder dialogue. Note if will try and use all files (not just text ones) so I usually create a special folder just for importing. I've go a macro I often use for looping through a folder of files. Is there any way the file name can be taken based upon current sheet name during "save as"? Is there any better and easier way of doing all this? May be like a batch mode etc. Hence every time I have to rename the saved file appropriately. However "sample1" gets hard coded in macro. Then Finish.Īfter recording macro, I am able to do step 2 to 4 with single key combination. Choose delimited file with pipe (|) delimiter and select text data type after selecting all column in next wizard tab. Select column A and use text to column wizard.ģ. Then it creates new workbook with single sheet with sheet name same as sample1 copying all lines in file under column A.Ģ. Just assume I have files as sample1.txt to … sampleN.txt. Below is what I found best efficient manual way of doing it. Also all the fields should be treated as text while converting it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |